diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /lib/gitlab/auth.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 1bb92b7fa62..cafa75d5f59 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -222,11 +222,11 @@ module Gitlab return unless valid_scoped_token?(token, all_available_scopes) - if project && token.user.project_bot? + if project && (token.user.project_bot? || token.user.service_account?) return unless can_read_project?(token.user, project) end - if token.user.can_log_in_with_non_expired_password? || token.user.project_bot? + if token.user.can_log_in_with_non_expired_password? || (token.user.project_bot? || token.user.service_account?) ::PersonalAccessTokens::LastUsedService.new(token).execute Gitlab::Auth::Result.new(token.user, nil, :personal_access_token, abilities_for_scopes(token.scopes)) @@ -238,7 +238,7 @@ module Gitlab end def bot_user_can_read_project?(user, project) - (user.project_bot? || user.security_policy_bot?) && can_read_project?(user, project) + (user.project_bot? || user.service_account? || user.security_policy_bot?) && can_read_project?(user, project) end def valid_oauth_token?(token) |