From 54d26c89f66abb2bfec7403fd6b3ed7700e73766 Mon Sep 17 00:00:00 2001 From: Robert Schilling Date: Tue, 12 Jul 2016 16:31:55 +0200 Subject: API: Expose 'developers_can_push' for branches --- lib/api/helpers.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/api/helpers.rb') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 73557cf7db6..d6e4eb2afd7 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -9,6 +9,13 @@ module API [ true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON' ].include?(value) end + def to_boolean(value) + return true if value =~ /^(true|t|yes|y|1|on)$/i + return false if value =~ /^(false|f|no|n|0|off)$/i + + nil + end + def find_user_by_private_token token_string = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s User.find_by_authentication_token(token_string) || User.find_by_personal_access_token(token_string) -- cgit v1.2.1