mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-23 17:01:13 +00:00
Send a single email to admins like other notifications (#21421).
git-svn-id: http://svn.redmine.org/redmine/trunk@15266 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4aef2735c8
commit
46a4151f09
@ -836,6 +836,7 @@ class User < Principal
|
|||||||
def self.generate_salt
|
def self.generate_salt
|
||||||
Redmine::Utils.random_hex(16)
|
Redmine::Utils.random_hex(16)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Send a security notification to all admins if the user has gained/lost admin privileges
|
# Send a security notification to all admins if the user has gained/lost admin privileges
|
||||||
def deliver_security_notification
|
def deliver_security_notification
|
||||||
options = {
|
options = {
|
||||||
@ -844,6 +845,7 @@ class User < Principal
|
|||||||
title: :label_user_plural,
|
title: :label_user_plural,
|
||||||
url: {controller: 'users', action: 'index'}
|
url: {controller: 'users', action: 'index'}
|
||||||
}
|
}
|
||||||
|
|
||||||
deliver = false
|
deliver = false
|
||||||
if (admin? && id_changed? && active?) || # newly created admin
|
if (admin? && id_changed? && active?) || # newly created admin
|
||||||
(admin? && admin_changed? && active?) || # regular user became admin
|
(admin? && admin_changed? && active?) || # regular user became admin
|
||||||
@ -860,11 +862,11 @@ class User < Principal
|
|||||||
options[:message] = :mail_body_security_notification_remove
|
options[:message] = :mail_body_security_notification_remove
|
||||||
end
|
end
|
||||||
|
|
||||||
User.where(admin: true, status: Principal::STATUS_ACTIVE).each{|u| Mailer.security_notification(u, options).deliver} if deliver
|
if deliver
|
||||||
|
users = User.active.where(admin: true).to_a
|
||||||
|
Mailer.security_notification(users, options).deliver
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class AnonymousUser < User
|
class AnonymousUser < User
|
||||||
|
|||||||
@ -71,8 +71,9 @@ module Redmine
|
|||||||
::I18n.l(date.to_date, options)
|
::I18n.l(date.to_date, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_time(time, include_date=true, user=User.current)
|
def format_time(time, include_date=true, user=nil)
|
||||||
return nil unless time
|
return nil unless time
|
||||||
|
user ||= User.current
|
||||||
options = {}
|
options = {}
|
||||||
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
|
options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
|
||||||
time = time.to_time if time.is_a?(String)
|
time = time.to_time if time.is_a?(String)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user