summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorSytse Sijbrandij <sytses@gmail.com>2014-10-21 13:22:07 +0200
committerSytse Sijbrandij <sytses@gmail.com>2014-10-21 13:22:07 +0200
commit2e4a33b28751e074cc240c69b9202564ac8c0eb7 (patch)
treed5f6c6d5ccebd75f0305cbac91d57fdfed100c2f /lib/api/helpers.rb
parente6631c87860c182ce9c838da6b4ad8d570061dfb (diff)
parentfbe9b00fc9304f3e4a98192be99a7dce17ae08a0 (diff)
downloadgitlab-ce-2e4a33b28751e074cc240c69b9202564ac8c0eb7.tar.gz
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index 3262884f6d3..027fb20ec46 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -67,6 +67,10 @@ module API
unauthorized! unless current_user
end
+ def authenticate_by_gitlab_shell_token!
+ unauthorized! unless secret_token == params['secret_token']
+ end
+
def authenticated_as_admin!
forbidden! unless current_user.is_admin?
end
@@ -193,5 +197,9 @@ module API
abilities
end
end
+
+ def secret_token
+ File.read(Rails.root.join('.gitlab_shell_secret'))
+ end
end
end