diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-06-28 07:12:23 +0000 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-06-29 06:15:57 +0000 |
commit | b8ec1f4201c74c500e4f7010b238c7920599da7a (patch) | |
tree | f13e0aab941b8ff209716315a4d21626db878373 /lib/gitlab/auth.rb | |
parent | c1fcd730cc9dbee5b41ce2a6a12f8d84416b1a4a (diff) | |
download | gitlab-ce-b8ec1f4201c74c500e4f7010b238c7920599da7a.tar.gz |
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.rb | 4 |
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 |