summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-19 15:35:44 +0200
committerJames Lopez <james@jameslopez.es>2017-06-23 11:41:42 +0200
commit831b2fccf9a2efc772d62c05f52c612f23a63ea9 (patch)
treec36fd08364a01f2ba713f8df5aa3dd1c69314220 /lib/api/users.rb
parent87bf08c96cf9f3c451d0746d11ceac149adf22db (diff)
downloadgitlab-ce-831b2fccf9a2efc772d62c05f52c612f23a63ea9.tar.gz
update missing email actions
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 940f8b64026..190e2e71884 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -98,7 +98,7 @@ module API
authenticated_as_admin!
params = declared_params(include_missing: false)
- user = ::Users::CreateService.new(current_user, params).execute
+ user = ::Users::CreateService.new(current_user, params).execute(skip_authorization: true)
if user.persisted?
present user, with: Entities::UserPublic
@@ -236,9 +236,7 @@ module API
user = User.find_by(id: params.delete(:id))
not_found!('User') unless user
- email = user.emails.new(declared_params(include_missing: false))
-
- if email.save
+ if Emails::CreateService.new(current_user, user, declared_params(include_missing: false)).execute(skip_authorization: true)
NotificationService.new.new_email(email)
present email, with: Entities::Email
else
@@ -276,7 +274,7 @@ module API
email = user.emails.find_by(id: params[:email_id])
not_found!('Email') unless email
- Emails::DestroyService.new(current_user, user, email: email.email).execute
+ Emails::DestroyService.new(current_user, user, email: email.email).execute(skip_authorization: true)
::Users::UpdateService.new(current_user, user).execute do |user|
user.update_secondary_emails!
@@ -494,7 +492,7 @@ module API
post "emails" do
email = current_user.emails.new(declared_params)
- if email.save
+ if Emails::CreateService.new(current_user, current_user, declared_params).execute
NotificationService.new.new_email(email)
present email, with: Entities::Email
else