summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorJoshua Lambert <joshua@gitlab.com>2017-03-16 18:45:46 +0000
committerJoshua Lambert <joshua@gitlab.com>2017-03-16 18:45:46 +0000
commitd2f209a60b2ea2d889eaf5142c8d09ba0848a4c3 (patch)
tree62810ea2d1f8aa1d131e31ad667c39ea0a6d466a /lib/api/helpers.rb
parent83259875939958c6288066a3a4e59a5062b4c9e6 (diff)
parentce5d1b6fd7ed1aea2d2a675414ba81be624f2bf1 (diff)
downloadgitlab-ce-29142-add-prometheus-integration-documentation.tar.gz
Merge branch 'master' into '29142-add-prometheus-integration-documentation'29142-add-prometheus-integration-documentation
# Conflicts: # doc/install/requirements.md
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a9b364da9e1..bd22b82476b 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -97,7 +97,7 @@ module API
end
def authenticate!
- unauthorized! unless current_user
+ unauthorized! unless current_user && can?(current_user, :access_api)
end
def authenticate_non_get!
@@ -116,7 +116,7 @@ module API
forbidden! unless current_user.is_admin?
end
- def authorize!(action, subject = nil)
+ def authorize!(action, subject = :global)
forbidden! unless can?(current_user, action, subject)
end
@@ -134,7 +134,7 @@ module API
end
end
- def can?(object, action, subject)
+ def can?(object, action, subject = :global)
Ability.allowed?(object, action, subject)
end