From 8ec59bd18bcacf13c012a34b3e37c2c9167bcc65 Mon Sep 17 00:00:00 2001 From: "Artem V. Navrotskiy" Date: Sat, 29 Aug 2015 12:52:21 +0300 Subject: Add API method for get user by ID of an SSH key --- lib/api/keys.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/api/keys.rb (limited to 'lib/api/keys.rb') diff --git a/lib/api/keys.rb b/lib/api/keys.rb new file mode 100644 index 00000000000..2b723b79504 --- /dev/null +++ b/lib/api/keys.rb @@ -0,0 +1,20 @@ +module API + # Keys API + class Keys < Grape::API + before { authenticate! } + + resource :keys do + # Get single ssh key by id. Only available to admin users. + # + # Example Request: + # GET /keys/:id + get ":id" do + authenticated_as_admin! + + key = Key.find(params[:id]) + + present key, with: Entities::SSHKeyWithUser + end + end + end +end -- cgit v1.2.1