diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/users.rb | 30 | ||||
-rw-r--r-- | lib/tasks/test.rake | 2 |
2 files changed, 31 insertions, 1 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 diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index b9f9c72c91f..c5666d49e61 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -9,5 +9,5 @@ unless Rails.env.production? require 'coveralls/rake/task' Coveralls::RakeTask.new desc "GitLab | Run all tests on CI with simplecov" - task :test_ci => [:rubocop, :brakeman, 'jasmine:ci', :spinach, :spec, 'coveralls:push'] + task :test_ci => [:rubocop, :brakeman, 'teaspoon', :spinach, :spec, 'coveralls:push'] end |