summaryrefslogtreecommitdiff
path: root/lib/api/api_guard.rb
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-06-21 09:22:39 +0000
committerTimothy Andrew <mail@timothyandrew.net>2017-06-28 07:17:13 +0000
commit1b8223dd51345f6075172a92dab610f9dee89d84 (patch)
tree426b9b5e599e074724941baf1ce3fbade6e3b4e8 /lib/api/api_guard.rb
parent8b399b185cf72f396be8d6b7caae37f2a3aa4279 (diff)
downloadgitlab-ce-1b8223dd51345f6075172a92dab610f9dee89d84.tar.gz
Fix remaining spec failures for !12300.
1. Get the spec for `lib/gitlab/auth.rb` passing. - Make the `request` argument to `AccessTokenValidationService` optional - `auth.rb` doesn't need to pass in a request. - Pass in scopes in the format `[{ name: 'api' }]` rather than `['api']`, which is what `AccessTokenValidationService` now expects. 2. Get the spec for `API::V3::Users` passing 2. Get the spec for `AccessTokenValidationService` passing
Diffstat (limited to 'lib/api/api_guard.rb')
-rw-r--r--lib/api/api_guard.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb
index 29ca760ec25..d4599aaeed0 100644
--- a/lib/api/api_guard.rb
+++ b/lib/api/api_guard.rb
@@ -66,7 +66,7 @@ module API
access_token = find_access_token
return nil unless access_token
- case AccessTokenValidationService.new(access_token, request).validate(scopes: scopes)
+ case AccessTokenValidationService.new(access_token, request: request).validate(scopes: scopes)
when AccessTokenValidationService::INSUFFICIENT_SCOPE
raise InsufficientScopeError.new(scopes)
@@ -103,7 +103,7 @@ module API
access_token = PersonalAccessToken.active.find_by_token(token_string)
return unless access_token
- if AccessTokenValidationService.new(access_token, request).include_any_scope?(scopes)
+ if AccessTokenValidationService.new(access_token, request: request).include_any_scope?(scopes)
User.find(access_token.user_id)
end
end