summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-07-03 16:17:02 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-07-03 16:17:02 +0200
commit26172aeeae069731daa3a4556ec1a46319f023a0 (patch)
tree7a0c02fc1bc7f0071bb3cf07c8177d01661efa55 /lib/api
parent6646a04d4cc6a4e421af6c56286b4aa4b8991d66 (diff)
parent50a04bdc28f8037131e7571370e87cf758181663 (diff)
downloadgitlab-ce-26172aeeae069731daa3a4556ec1a46319f023a0.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/users.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 9b268cfe8bc..c468371d3d4 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -199,6 +199,36 @@ module API
not_found!('User')
end
end
+
+ # Block user. Available only for admin
+ #
+ # Example Request:
+ # PUT /users/:id/block
+ put ':id/block' do
+ authenticated_as_admin!
+ user = User.find_by(id: params[:id])
+
+ if user
+ user.block
+ else
+ not_found!('User')
+ end
+ end
+
+ # Unblock user. Available only for admin
+ #
+ # Example Request:
+ # PUT /users/:id/unblock
+ put ':id/unblock' do
+ authenticated_as_admin!
+ user = User.find_by(id: params[:id])
+
+ if user
+ user.activate
+ else
+ not_found!('User')
+ end
+ end
end
resource :user do