summaryrefslogtreecommitdiff
path: root/lib/api/api_guard.rb
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-06-23 11:18:44 +0000
committerTimothy Andrew <mail@timothyandrew.net>2017-06-28 07:17:13 +0000
commit4dbfa14e160e0d9bca11941adcf04b3d272aa1a2 (patch)
tree9affe145ebecd6e57ced495fa18d29d2a406d37a /lib/api/api_guard.rb
parent1b8223dd51345f6075172a92dab610f9dee89d84 (diff)
downloadgitlab-ce-4dbfa14e160e0d9bca11941adcf04b3d272aa1a2.tar.gz
Implement review comments from @dbalexandre for !12300.
Diffstat (limited to 'lib/api/api_guard.rb')
-rw-r--r--lib/api/api_guard.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
index d4599aaeed0..8411ad8ec34 100644
--- a/lib/api/api_guard.rb
+++ b/lib/api/api_guard.rb
@@ -30,15 +30,13 @@ module API
# endpoint class. If this method is called multiple times on the same class,
# the scopes are all aggregated.
def allow_access_with_scope(scopes, options = {})
- @scopes ||= []
-
- params = Array.wrap(scopes).map { |scope| { name: scope, if: options[:if] } }
-
- @scopes.concat(params)
+ Array(scopes).each do |scope|
+ allowed_scopes << { name: scope, if: options[:if] }
+ end
end
- def scopes
- @scopes
+ def allowed_scopes
+ @scopes ||= []
end
end