diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-20 15:10:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-20 15:10:00 +0300 |
commit | 50ea04b6c6823aa1bd8d64cd9a77dcbd03b19053 (patch) | |
tree | de2a6a76b4943f71cf8fed80cd8734731ec0da5a /lib/gitlab/auth.rb | |
parent | 078e8bf78bfe2f41af6ca58858f093a53c719ba4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/auth.rb')
-rw-r--r-- | lib/gitlab/auth.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index c97ef5a10ef..06bdb2c1ddc 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -32,7 +32,7 @@ module Gitlab # Scopes used for GitLab as admin SUDO_SCOPE = :sudo ADMIN_MODE_SCOPE = :admin_mode - ADMIN_SCOPES = [SUDO_SCOPE].freeze + ADMIN_SCOPES = [SUDO_SCOPE, ADMIN_MODE_SCOPE].freeze # Default scopes for OAuth applications that don't define their own DEFAULT_SCOPES = [API_SCOPE].freeze @@ -366,7 +366,10 @@ module Gitlab def available_scopes_for(current_user) scopes = non_admin_available_scopes - scopes += ADMIN_SCOPES if current_user.admin? + + if current_user.admin? # rubocop: disable Cop/UserAdmin + scopes += Feature.enabled?(:admin_mode_for_api) ? ADMIN_SCOPES : [SUDO_SCOPE] + end scopes end |