summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 12:07:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-04 12:07:52 +0000
commitc6c7437861bff9572747674095c4dfbdfbea4988 (patch)
tree237d1ed922193f19ae326923457344c082003788 /lib/api/users.rb
parentd80f3cd75e700b6e62910865bfd36734644ffa89 (diff)
downloadgitlab-ce-c6c7437861bff9572747674095c4dfbdfbea4988.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index c6dc7c08b11..5b51f114fb4 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -528,11 +528,18 @@ module API
user = User.find_by(id: params[:id])
not_found!('User') unless user
- if !user.ldap_blocked?
- user.block
- else
+ if user.ldap_blocked?
forbidden!('LDAP blocked users cannot be modified by the API')
end
+
+ break if user.blocked?
+
+ result = ::Users::BlockService.new(current_user).execute(user)
+ if result[:status] == :success
+ true
+ else
+ render_api_error!(result[:message], result[:http_status])
+ end
end
# rubocop: enable CodeReuse/ActiveRecord