##// END OF EJS Templates
Send a single email to admins like other notifications (#21421)....
Jean-Philippe Lang -
r14884:46a4151f0935
parent child
Show More
@@ -836,6 +836,7 class User < Principal
836 836 def self.generate_salt
837 837 Redmine::Utils.random_hex(16)
838 838 end
839
839 840 # Send a security notification to all admins if the user has gained/lost admin privileges
840 841 def deliver_security_notification
841 842 options = {
@@ -844,6 +845,7 class User < Principal
844 845 title: :label_user_plural,
845 846 url: {controller: 'users', action: 'index'}
846 847 }
848
847 849 deliver = false
848 850 if (admin? && id_changed? && active?) || # newly created admin
849 851 (admin? && admin_changed? && active?) || # regular user became admin
@@ -860,11 +862,11 class User < Principal
860 862 options[:message] = :mail_body_security_notification_remove
861 863 end
862 864
863 User.where(admin: true, status: Principal::STATUS_ACTIVE).each{|u| Mailer.security_notification(u, options).deliver} if deliver
865 if deliver
866 users = User.active.where(admin: true).to_a
867 Mailer.security_notification(users, options).deliver
868 end
864 869 end
865
866
867
868 870 end
869 871
870 872 class AnonymousUser < User
@@ -71,8 +71,9 module Redmine
71 71 ::I18n.l(date.to_date, options)
72 72 end
73 73
74 def format_time(time, include_date=true, user=User.current)
74 def format_time(time, include_date=true, user=nil)
75 75 return nil unless time
76 user ||= User.current
76 77 options = {}
77 78 options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
78 79 time = time.to_time if time.is_a?(String)
General Comments 0
You need to be logged in to leave comments. Login now