summaryrefslogtreecommitdiff
path: root/lib/api/keys.rb
diff options
context:
space:
mode:
authorArtem V. Navrotskiy <bozaro@users.noreply.github.com>2015-08-29 12:52:21 +0300
committerArtem V. Navrotskiy <navrotskiy@corp.mail.ru>2015-09-03 15:47:22 +0300
commit8ec59bd18bcacf13c012a34b3e37c2c9167bcc65 (patch)
tree4b654ce3e78bb82e5341fb13ca36a5c7005398bf /lib/api/keys.rb
parentff8fb6a6a26578c02f04a2f7450a769b2f293d58 (diff)
downloadgitlab-ce-8ec59bd18bcacf13c012a34b3e37c2c9167bcc65.tar.gz
Add API method for get user by ID of an SSH key
Diffstat (limited to 'lib/api/keys.rb')
-rw-r--r--lib/api/keys.rb20
1 files changed, 20 insertions, 0 deletions
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