summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-20 09:08:32 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-20 09:08:32 +0000
commit2ee5991b42717969af93cb30d863aafab04dff8a (patch)
treec09c0b7b4d02ceb9d6ac090c1ccfb93effb8a368 /lib/api/users.rb
parent6b1ba27ef7373815ea29dc5b80eab846c8acd022 (diff)
downloadgitlab-ce-2ee5991b42717969af93cb30d863aafab04dff8a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index bf1fe4fc4a8..120f66b6a71 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -252,17 +252,15 @@ module API
success Entities::SSHKey
end
params do
- requires :id, type: Integer, desc: 'The ID of the user'
+ requires :user_id, type: String, desc: 'The ID or username of the user'
use :pagination
end
- # rubocop: disable CodeReuse/ActiveRecord
- get ':id/keys' do
- user = User.find_by(id: params[:id])
+ get ':user_id/keys', requirements: API::USER_REQUIREMENTS do
+ user = find_user(params[:user_id])
not_found!('User') unless user && can?(current_user, :read_user, user)
present paginate(user.keys), with: Entities::SSHKey
end
- # rubocop: enable CodeReuse/ActiveRecord
desc 'Delete an existing SSH key from a specified user. Available only for admins.' do
success Entities::SSHKey