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:
authorDouwe Maan <douwe@selenight.nl>2017-10-12 15:38:39 +0300
committerDouwe Maan <douwe@selenight.nl>2017-11-02 13:39:03 +0300
commit3f24f9ed182f5226210349b8e67e484e132ce971 (patch)
tree6f6a9148f3d89ea2d19cefe90470a8dca4dabc64 /app/services/access_token_validation_service.rb
parenta1781a49416790f727b3dd3453bf704723e72b90 (diff)
Add sudo API scope
Diffstat (limited to 'app/services/access_token_validation_service.rb')
-rw-r--r--app/services/access_token_validation_service.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/services/access_token_validation_service.rb b/app/services/access_token_validation_service.rb
index 9c00ea789ec..46e19230328 100644
--- a/app/services/access_token_validation_service.rb
+++ b/app/services/access_token_validation_service.rb
@@ -39,11 +39,8 @@ class AccessTokenValidationService
token_scopes = token.scopes.map(&:to_sym)
required_scopes.any? do |scope|
- if scope.respond_to?(:sufficient?)
- scope.sufficient?(token_scopes, request)
- else
- API::Scope.new(scope).sufficient?(token_scopes, request)
- end
+ scope = API::Scope.new(scope) unless scope.is_a?(API::Scope)
+ scope.sufficient?(token_scopes, request)
end
end
end