1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

Improve MailHandler logging for unauthorized attempts (#31899).

Patch by Gustavo Regal.


git-svn-id: http://svn.redmine.org/redmine/trunk@18404 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2019-08-27 15:42:05 +00:00
parent 217bf46029
commit e9d74c01d0

View File

@ -171,7 +171,7 @@ class MailHandler < ActionMailer::Base
logger&.error "MailHandler: missing information from #{user}: #{e.message}"
false
rescue UnauthorizedAction => e
logger&.error "MailHandler: unauthorized attempt from #{user}"
logger&.error "MailHandler: unauthorized attempt from #{user}: #{e.message}"
false
end
@ -184,7 +184,7 @@ class MailHandler < ActionMailer::Base
project = target_project
# check permission
unless handler_options[:no_permission_check]
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
raise UnauthorizedAction, "not allowed to add issues to project [#{project.name}]" unless user.allowed_to?(:add_issues, project)
end
issue = Issue.new(:author => user, :project => project)
@ -223,7 +223,7 @@ class MailHandler < ActionMailer::Base
unless handler_options[:no_permission_check]
unless user.allowed_to?(:add_issue_notes, issue.project) ||
user.allowed_to?(:edit_issues, issue.project)
raise UnauthorizedAction
raise UnauthorizedAction, "not allowed to add notes on issues to project [#{project.name}]"
end
end
@ -262,7 +262,7 @@ class MailHandler < ActionMailer::Base
message = message.root
unless handler_options[:no_permission_check]
raise UnauthorizedAction unless user.allowed_to?(:add_messages, message.project)
raise UnauthorizedAction, "not allowed to add messages to project [#{project.name}]" unless user.allowed_to?(:add_messages, message.project)
end
if !message.locked?