summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-16 11:12:06 +0200
committerJames Lopez <james@jameslopez.es>2017-06-23 11:41:42 +0200
commit158550cf37cc2db9590f0212962f10ecc73082de (patch)
tree3b48192a0eda2b96cf7de3c3f705a60346e18026 /lib
parentbf3a3f3652704fb261e6220e2199830ea22ec8d3 (diff)
downloadgitlab-ce-158550cf37cc2db9590f0212962f10ecc73082de.tar.gz
added service in the rest of controllers and classes
Diffstat (limited to 'lib')
-rw-r--r--lib/api/internal.rb2
-rw-r--r--lib/api/users.rb4
-rw-r--r--lib/gitlab/ldap/access.rb3
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 479ee16a611..8606ff75e11 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -133,7 +133,7 @@ module API
end
codes = user.generate_otp_backup_codes!
- user.save!
+ ::Users::UpdateService.new(user, user).execute!
{ success: true, recovery_codes: codes }
end
diff --git a/lib/api/users.rb b/lib/api/users.rb
index ba59818ba84..2c632c85243 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -278,7 +278,7 @@ module API
email.destroy
- Users::UpdateService.new(current_user, user).execute do |user|
+ ::Users::UpdateService.new(current_user, user).execute do |user|
user.update_secondary_emails!
end
end
@@ -511,7 +511,7 @@ module API
not_found!('Email') unless email
email.destroy
- Users::UpdateService.new(current_user, user).execute do |user|
+ ::Users::UpdateService.new(current_user, user).execute do |user|
user.update_secondary_emails!
end
end
diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb
index 54a5b1d31cd..7430db828a3 100644
--- a/lib/gitlab/ldap/access.rb
+++ b/lib/gitlab/ldap/access.rb
@@ -17,7 +17,8 @@ module Gitlab
self.open(user) do |access|
if access.allowed?
user.last_credential_check_at = Time.now
- user.save
+ Users::UpdateService.new(user, user).execute
+
true
else
false