summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-04-07 10:35:00 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-04-07 10:35:00 +0200
commitb38439a3ae3c7ea1675b7037e4882213bdc58fdf (patch)
tree5d3c9aaa712b30a835e3d8e649acd95d2dc640f1
parent5bc58bac2678aed9c8b2318f9f4d4825baa2b110 (diff)
downloadgitlab-ce-b38439a3ae3c7ea1675b7037e4882213bdc58fdf.tar.gz
Use proper auth_scope for deploy token
-rw-r--r--lib/gitlab/auth.rb2
-rw-r--r--spec/lib/gitlab/auth_spec.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb
index f88f9d2d808..2a44e11efb6 100644
--- a/lib/gitlab/auth.rb
+++ b/lib/gitlab/auth.rb
@@ -164,7 +164,7 @@ module Gitlab
def abilities_for_scopes(scopes)
abilities_by_scope = {
api: full_authentication_abilities,
- read_registry: [:build_read_container_image],
+ read_registry: [:read_container_image],
read_repository: [:download_code]
}
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
index e3ec707076a..9ccd0b206cc 100644
--- a/spec/lib/gitlab/auth_spec.rb
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -195,7 +195,7 @@ describe Gitlab::Auth do
personal_access_token = create(:personal_access_token, scopes: ['read_registry'])
expect(gl_auth).to receive(:rate_limit!).with('ip', success: true, login: '')
- expect(gl_auth.find_for_git_client('', personal_access_token.token, project: nil, ip: 'ip')).to eq(Gitlab::Auth::Result.new(personal_access_token.user, nil, :personal_access_token, [:build_read_container_image]))
+ expect(gl_auth.find_for_git_client('', personal_access_token.token, project: nil, ip: 'ip')).to eq(Gitlab::Auth::Result.new(personal_access_token.user, nil, :personal_access_token, [:read_container_image]))
end
end
@@ -317,7 +317,7 @@ describe Gitlab::Auth do
end
it 'succeeds when login and token are valid' do
- auth_success = Gitlab::Auth::Result.new(deploy_token, project, :deploy_token, [:build_read_container_image])
+ auth_success = Gitlab::Auth::Result.new(deploy_token, project, :deploy_token, [:read_container_image])
expect(gl_auth).to receive(:rate_limit!).with('ip', success: true, login: login)
expect(gl_auth.find_for_git_client(login, deploy_token.token, project: nil, ip: 'ip'))