summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-01-14 17:28:44 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-01-14 17:28:44 -0500
commitc8db25c37c0d78457d06117497ccde7ad80e2321 (patch)
treedc2db4637c33c53b032a22f8e78975838396ed13 /lib/api/users.rb
parent6b9c730e91962a6d6343bcb7fc4dc75c99b41bde (diff)
parent948bb655f3cba9909b7396c3062da7b22f4409b3 (diff)
downloadgitlab-ce-c8db25c37c0d78457d06117497ccde7ad80e2321.tar.gz
Merge branch 'master' into issue_3945
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 3400f0713ef..fd2128bd179 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -39,7 +39,7 @@ module API
if current_user.is_admin?
present @user, with: Entities::UserFull
else
- present @user, with: Entities::UserBasic
+ present @user, with: Entities::User
end
end
@@ -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