summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2016-01-21 22:59:15 +0100
committerAchilleas Pipinellis <axilleas@axilleas.me>2016-01-21 22:59:15 +0100
commit308abc8db05f75da8f1cc66facb5e85bee5c69c4 (patch)
tree6b0acf3cbcf7036fb831381cfe195ad572d6a3c8 /lib/api/users.rb
parenta42fe49c8c953c0aa8ca20c8fb5a141447128894 (diff)
parentc176fb40a52d32edc54843a5b54884cbab1e67e1 (diff)
downloadgitlab-ce-308abc8db05f75da8f1cc66facb5e85bee5c69c4.tar.gz
Merge branch 'master' into housekeeping-doc
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 0d7813428e2..fd2128bd179 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -284,10 +284,12 @@ module API
authenticated_as_admin!
user = User.find_by(id: params[:id])
- if user
+ if !user
+ not_found!('User')
+ elsif !user.ldap_blocked?
user.block
else
- not_found!('User')
+ forbidden!('LDAP blocked users cannot be modified by the API')
end
end
@@ -299,10 +301,12 @@ module API
authenticated_as_admin!
user = User.find_by(id: params[:id])
- if user
- user.activate
- else
+ if !user
not_found!('User')
+ elsif user.ldap_blocked?
+ forbidden!('LDAP blocked users cannot be unblocked by the API')
+ else
+ user.activate
end
end
end