diff options
author | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-03-07 14:51:56 +0100 |
---|---|---|
committer | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-03-07 14:51:56 +0100 |
commit | 3374027e3a4e4eb040e59294a9ced9d7886a71e2 (patch) | |
tree | 4587984396a32047a6337e7810a39633ba683545 /lib/api/users.rb | |
parent | 39114d259c6e4bd5bb60b18f561d06cc24e8c852 (diff) | |
parent | 9c2a6e201388e7e30987a8679ddfa65b9422a38c (diff) | |
download | gitlab-ce-3374027e3a4e4eb040e59294a9ced9d7886a71e2.tar.gz |
Merge branch 'master' into fixes/api, code clean up and tests fixed
Conflicts:
doc/api/projects.md
spec/requests/api/projects_spec.rb
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r-- | lib/api/users.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index 5e0680de71a..6cc3a7e52c9 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -81,6 +81,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: |