Project

General

Profile

Patch #31899 » MailLogger_cause_logging_improvement.diff

Gustavo Regal, 2019-08-14 16:23

View differences:

mail_handler.rb (working copy)
171 171
    logger&.error "MailHandler: missing information from #{user}: #{e.message}"
172 172
    false
173 173
  rescue UnauthorizedAction => e
174
    logger&.error "MailHandler: unauthorized attempt from #{user}"
174
    logger&.error "MailHandler: unauthorized attempt from #{user}: #{e.message}"
175 175
    false
176 176
  end
177 177

  
......
184 184
    project = target_project
185 185
    # check permission
186 186
    unless handler_options[:no_permission_check]
187
      raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
187
      raise UnauthorizedAction, "User not allowed to add issues to project '#{project.name}'" unless user.allowed_to?(:add_issues, project)
188 188
    end
189 189

  
190 190
    issue = Issue.new(:author => user, :project => project)
......
223 223
    unless handler_options[:no_permission_check]
224 224
      unless user.allowed_to?(:add_issue_notes, issue.project) ||
225 225
               user.allowed_to?(:edit_issues, issue.project)
226
        raise UnauthorizedAction
226
        raise UnauthorizedAction, "User not allowed to add notes to issues on project '#{project.name}'"
227 227
      end
228 228
    end
229 229

  
......
262 262
      message = message.root
263 263

  
264 264
      unless handler_options[:no_permission_check]
265
        raise UnauthorizedAction unless user.allowed_to?(:add_messages, message.project)
265
        raise UnauthorizedAction, "User not allowed to add messages to this project #{project.name}" unless user.allowed_to?(:add_messages, message.project)
266 266
      end
267 267

  
268 268
      if !message.locked?
(1-1/2)