diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2016-07-12 16:31:55 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2016-07-19 11:11:56 +0200 |
commit | 54d26c89f66abb2bfec7403fd6b3ed7700e73766 (patch) | |
tree | 7ee19c7d2ea3f2c57f739a3d97dbae04a7daafd0 /lib/api/helpers.rb | |
parent | 78cd5b8d0e0a69d7b1681bf98b17ccb7a22dde5f (diff) | |
download | gitlab-ce-54d26c89f66abb2bfec7403fd6b3ed7700e73766.tar.gz |
API: Expose 'developers_can_push' for branches
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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) |