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