summaryrefslogtreecommitdiff
path: root/lib/api/keys.rb
blob: d5280a0035d547567bd68d9dbb2b87be7adc83ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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