summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-01-06 11:16:00 +0000
committerRémy Coutable <remy@rymai.me>2017-01-06 11:16:00 +0000
commit4c343310846c1353179a4f690eb8b05e8610ea22 (patch)
tree71d18c17ecfa1c7fb179bd4c7f69ec66490438e5 /lib/api
parent11f3da9dc75a06c30d8801f6812b70f6ba31cc9d (diff)
parent8b1914ceb22d2312da6160eae5e0a586e9aa2a65 (diff)
downloadgitlab-ce-4c343310846c1353179a4f690eb8b05e8610ea22.tar.gz
Merge branch 'fix-users-api-500-error' into 'master'
Fix 500 errors when creating a user with identity via API Closes #26295 See merge request !8442
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/users.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index de07fbf59fc..0db76ec7877 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -91,10 +91,11 @@ module API
authenticated_as_admin!
# Filter out params which are used later
- identity_attrs = params.slice(:provider, :extern_uid)
+ user_params = declared_params(include_missing: false)
+ identity_attrs = user_params.slice(:provider, :extern_uid)
confirm = params.delete(:confirm)
- user = User.new(declared_params(include_missing: false))
+ user = User.new(user_params.except(:extern_uid, :provider))
user.skip_confirmation! unless confirm
if identity_attrs.any?
@@ -159,11 +160,7 @@ module API
end
end
- # Delete already handled parameters
- user_params.delete(:extern_uid)
- user_params.delete(:provider)
-
- if user.update_attributes(user_params)
+ if user.update_attributes(user_params.except(:extern_uid, :provider))
present user, with: Entities::UserPublic
else
render_validation_error!(user)