Skip to content
Snippets Groups Projects
Commit 5becbe24 authored by Timothy Andrew's avatar Timothy Andrew
Browse files

Rename the `token_has_scope?` method.

`valid_api_token?` is a better name. Scopes are just (potentially) one facet of
a "valid" token.
parent b303948f
No related branches found
No related tags found
No related merge requests found
Loading
@@ -111,14 +111,14 @@ module Gitlab
Loading
@@ -111,14 +111,14 @@ module Gitlab
end end
   
def valid_oauth_token?(token) def valid_oauth_token?(token)
token && token.accessible? && token_has_scope?(token) token && token.accessible? && valid_api_token?(token)
end end
   
def valid_personal_access_token?(token, user) def valid_personal_access_token?(token, user)
token && token.user == user && token_has_scope?(token) token && token.user == user && valid_api_token?(token)
end end
   
def token_has_scope?(token) def valid_api_token?(token)
AccessTokenValidationService.new(token).include_any_scope?(['api']) AccessTokenValidationService.new(token).include_any_scope?(['api'])
end end
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment