Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-06-28 10:12:23 +0300
committerTimothy Andrew <mail@timothyandrew.net>2017-06-29 09:15:57 +0300
commitb8ec1f4201c74c500e4f7010b238c7920599da7a (patch)
treef13e0aab941b8ff209716315a4d21626db878373 /lib/gitlab/auth.rb
parentc1fcd730cc9dbee5b41ce2a6a12f8d84416b1a4a (diff)
Extract a `Gitlab::Scope` class.
- To represent an authorization scope, such as `api` or `read_user` - This is a better abstraction than the hash we were previously using.
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r--lib/gitlab/auth.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index ec73255b20a..6d0d638ba14 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -136,11 +136,11 @@ module Gitlab
end
def valid_oauth_token?(token)
- token && token.accessible? && valid_scoped_token?(token, ['api'])
+ token && token.accessible? && valid_scoped_token?(token, [:api])
end
def valid_scoped_token?(token, scopes)
- scopes = scopes.map { |scope| OpenStruct.new(name: scope) }
+ scopes = scopes.map { |scope| API::Scope.new(scope) }
AccessTokenValidationService.new(token).include_any_scope?(scopes)
end