summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-06 22:57:24 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-06 22:57:24 -0800
commit7c408960ce9cf8a20941c99fd64aa5b1f472f9a0 (patch)
tree7e81d11387865cd41279c6ba2672c019e1550052 /lib/api/users.rb
parent52bf5b0e78edeb1acc8254b00ba164d48a88f39e (diff)
parent47abdc10ca7daceac8206a65166b42409a76b459 (diff)
downloadgitlab-ce-7c408960ce9cf8a20941c99fd64aa5b1f472f9a0.tar.gz
Merge pull request #3146 from amacarthur/AdminAPIs
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: