summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorAngus MacArthur <amacarthur@rim.com>2012-11-14 15:37:52 -0500
committerAngus MacArthur <amacarthur@blackberry.com>2013-03-05 10:38:43 -0500
commit61ffcab60fef2efcd54b8496aa09de79ee999a2c (patch)
tree7a493e25800421cdb94607b52836d50274d5c0f7 /lib/api/users.rb
parentd5663e148fdf8d1c767479e62c86c7a2b4db654e (diff)
downloadgitlab-ce-61ffcab60fef2efcd54b8496aa09de79ee999a2c.tar.gz
Additional Admin APIs
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 7ea90c75e9e..7399d1a5034 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -77,6 +77,26 @@ module Gitlab
end
end
+ # Add ssh key to a specified user. Only available to admin users.
+ #
+ # Parameters:
+ # id (required) - The ID of a user
+ # key (required) - New SSH Key
+ # title (required) - New SSH Key's title
+ # Example Request:
+ # POST /users/:id/keys
+ post ":id/keys" do
+ authenticated_as_admin!
+ user = User.find(params[:id])
+ attrs = attributes_for_keys [:title, :key]
+ key = user.keys.new attrs
+ if key.save
+ present key, with: Entities::SSHKey
+ else
+ not_found!
+ end
+ end
+
# Delete user. Available only for admin
#
# Example Request: