gitlab-org--gitlab-foss/lib/api/keys.rb
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00

21 lines
453 B
Ruby

# frozen_string_literal: true
module API
# Keys API
class Keys < Grape::API
before { authenticate! }
resource :keys do
desc 'Get single ssh key by id. Only available to admin users' do
success Entities::SSHKeyWithUser
end
get ":id" do
authenticated_as_admin!
key = Key.find(params[:id])
present key, with: Entities::SSHKeyWithUser, current_user: current_user
end
end
end
end