mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +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:
parent
217bf46029
commit
e9d74c01d0
@ -171,7 +171,7 @@ class MailHandler < ActionMailer::Base
|
|||||||
logger&.error "MailHandler: missing information from #{user}: #{e.message}"
|
logger&.error "MailHandler: missing information from #{user}: #{e.message}"
|
||||||
false
|
false
|
||||||
rescue UnauthorizedAction => e
|
rescue UnauthorizedAction => e
|
||||||
logger&.error "MailHandler: unauthorized attempt from #{user}"
|
logger&.error "MailHandler: unauthorized attempt from #{user}: #{e.message}"
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class MailHandler < ActionMailer::Base
|
|||||||
project = target_project
|
project = target_project
|
||||||
# check permission
|
# check permission
|
||||||
unless handler_options[:no_permission_check]
|
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
|
end
|
||||||
|
|
||||||
issue = Issue.new(:author => user, :project => project)
|
issue = Issue.new(:author => user, :project => project)
|
||||||
@ -223,7 +223,7 @@ class MailHandler < ActionMailer::Base
|
|||||||
unless handler_options[:no_permission_check]
|
unless handler_options[:no_permission_check]
|
||||||
unless user.allowed_to?(:add_issue_notes, issue.project) ||
|
unless user.allowed_to?(:add_issue_notes, issue.project) ||
|
||||||
user.allowed_to?(:edit_issues, 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
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ class MailHandler < ActionMailer::Base
|
|||||||
message = message.root
|
message = message.root
|
||||||
|
|
||||||
unless handler_options[:no_permission_check]
|
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
|
end
|
||||||
|
|
||||||
if !message.locked?
|
if !message.locked?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user