diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /lib/api/api_guard.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'lib/api/api_guard.rb')
-rw-r--r-- | lib/api/api_guard.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/api/api_guard.rb b/lib/api/api_guard.rb index 9dd2de5c7ba..c6557fce541 100644 --- a/lib/api/api_guard.rb +++ b/lib/api/api_guard.rb @@ -65,7 +65,8 @@ module API end def find_user_from_sources - find_user_from_access_token || + deploy_token_from_request || + find_user_from_access_token || find_user_from_job_token || find_user_from_warden end @@ -90,12 +91,16 @@ module API end def api_access_allowed?(user) - Gitlab::UserAccess.new(user).allowed? && user.can?(:access_api) + user_allowed_or_deploy_token?(user) && user.can?(:access_api) end def api_access_denied_message(user) Gitlab::Auth::UserAccessDeniedReason.new(user).rejection_message end + + def user_allowed_or_deploy_token?(user) + Gitlab::UserAccess.new(user).allowed? || user.is_a?(DeployToken) + end end class_methods do |