summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-02-28 13:08:07 -0800
committerhttp://jneen.net/ <jneen@jneen.net>2017-03-09 11:49:52 -0800
commit846e581732e291f8927d04a5b1b40fe8f2688885 (patch)
tree50e0a538e26ac47f37ba68f93898185608c09096 /lib/api/helpers.rb
parent130fd255bc0735d4175f2db2770a9092882fa3a4 (diff)
downloadgitlab-ce-846e581732e291f8927d04a5b1b40fe8f2688885.tar.gz
use a magic default :global symbol instead of nil
to make sure we mean the global permissions
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index a9b364da9e1..e5f5de2af57 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -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