diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-10-12 14:38:39 +0200 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-11-02 11:39:03 +0100 |
commit | 3f24f9ed182f5226210349b8e67e484e132ce971 (patch) | |
tree | 6f6a9148f3d89ea2d19cefe90470a8dca4dabc64 /lib/gitlab | |
parent | a1781a49416790f727b3dd3453bf704723e72b90 (diff) | |
download | gitlab-ce-3f24f9ed182f5226210349b8e67e484e132ce971.tar.gz |
Add sudo API scope
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/auth.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 2d8f4654b4b..0ad9285c0ea 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -5,7 +5,7 @@ module Gitlab REGISTRY_SCOPES = [:read_registry].freeze # Scopes used for GitLab API access - API_SCOPES = [:api, :read_user].freeze + API_SCOPES = [:api, :read_user, :sudo].freeze # Scopes used for OpenID Connect OPENID_SCOPES = [:openid].freeze @@ -226,8 +226,10 @@ module Gitlab [] end - def available_scopes - API_SCOPES + registry_scopes + def available_scopes(current_user = nil) + scopes = API_SCOPES + registry_scopes + scopes.delete(:sudo) if current_user && !current_user.admin? + scopes end # Other available scopes |