From 7d55c1353d6402f33a9fef734148fb776da076d3 Mon Sep 17 00:00:00 2001 From: Ronald Claveau Date: Thu, 28 Jun 2018 08:13:21 +0200 Subject: List public ssh keys by id or username without authentication --- lib/api/users.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/api') diff --git a/lib/api/users.rb b/lib/api/users.rb index ac09ca7f7b7..e96887948b1 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -254,7 +254,7 @@ module API end # rubocop: enable CodeReuse/ActiveRecord - desc 'Get the SSH keys of a specified user. Available only for admins.' do + desc 'Get the SSH keys of a specified user.' do success Entities::SSHKey end params do @@ -263,10 +263,8 @@ module API end # rubocop: disable CodeReuse/ActiveRecord get ':id/keys' do - authenticated_as_admin! - user = User.find_by(id: params[:id]) - not_found!('User') unless user + not_found!('User') unless user && can?(current_user, :read_user, user) present paginate(user.keys), with: Entities::SSHKey end -- cgit v1.2.1