summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 09:27:24 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 09:27:24 +0000
commitd10ecacc47c1bb640621eef620eb3099ca81f0da (patch)
tree3854cdcb2a13c43c70a3af96ea35ef4ae5ac07fd /lib/api/helpers.rb
parent9d3e384ae6553fee85b7a1ed2b99a18a9884606e (diff)
parent37c4ba6f8d8b6be9f15bd0df701c64eea9c4d8e4 (diff)
downloadgitlab-ce-d10ecacc47c1bb640621eef620eb3099ca81f0da.tar.gz
Merge branch 'master' into 'master'
Let users limit by archived/not archived projects in GitLab API GET /projects Adds a boolean parameter, archived, to the /projects endpoint. See merge request !158
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index d7d209e16f7..8189e433789 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -5,6 +5,10 @@ module API
SUDO_HEADER ="HTTP_SUDO"
SUDO_PARAM = :sudo
+ def parse_boolean(value)
+ [ true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON' ].include?(value)
+ end
+
def current_user
private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s
@current_user ||= User.find_by(authentication_token: private_token)