From 970582079ad9384920b69957cfd0a6dc92ed4404 Mon Sep 17 00:00:00 2001 From: mortyccp Date: Sun, 2 Dec 2018 11:57:43 +0800 Subject: [PATCH] Fix lint error --- lib/gitlab/middleware/go.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/middleware/go.rb b/lib/gitlab/middleware/go.rb index 692e3ab187e..0ef106920dd 100644 --- a/lib/gitlab/middleware/go.rb +++ b/lib/gitlab/middleware/go.rb @@ -132,13 +132,16 @@ module Gitlab def current_user_from_basic_authentication?(request, project) return unless has_basic_credentials?(request) + login, password = user_name_and_password(request) auth_result = Gitlab::Auth.find_for_git_client(login, password, project: project, ip: request.ip) return unless auth_result.success? + return unless auth_result.actor&.can?(:access_api) + if auth_result.type == :personal_access_token - apiScopeAbilities = Gitlab::Auth.abilities_for_scopes([:api]) - return unless auth_result.authentication_abilities.sort == apiScopeAbilities.sort + api_sceope_abilities = Gitlab::Auth.abilities_for_scopes([:api]) + return unless auth_result.authentication_abilities.sort == api_sceope_abilities.sort end auth_result.actor