summaryrefslogtreecommitdiff
path: root/lib/api/api_guard.rb
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-06-26 04:14:10 +0000
committerTimothy Andrew <mail@timothyandrew.net>2017-06-28 07:17:13 +0000
commitc1fcd730cc9dbee5b41ce2a6a12f8d84416b1a4a (patch)
treeb3ae8410df1ef28e724ae04a3bb9445f3720f44c /lib/api/api_guard.rb
parent4dbfa14e160e0d9bca11941adcf04b3d272aa1a2 (diff)
downloadgitlab-ce-c1fcd730cc9dbee5b41ce2a6a12f8d84416b1a4a.tar.gz
Implement review comments from @DouweM for !12300.
- Use a struct for scopes, so we can call `scope.if` instead of `scope[:if]` - Refactor the "remove scopes whose :if condition returns false" logic to use a `select` rather than a `reject`.
Diffstat (limited to 'lib/api/api_guard.rb')
-rw-r--r--lib/api/api_guard.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
index 8411ad8ec34..56f6da57555 100644
--- a/lib/api/api_guard.rb
+++ b/lib/api/api_guard.rb
@@ -31,7 +31,7 @@ module API
# the scopes are all aggregated.
def allow_access_with_scope(scopes, options = {})
Array(scopes).each do |scope|
- allowed_scopes << { name: scope, if: options[:if] }
+ allowed_scopes << OpenStruct.new(name: scope.to_sym, if: options[:if])
end
end