]> source.dussan.org Git - redmine.git/commitdiff
Don't check permission to add watchers if no_permission_check option is set (#7017).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 22 Jan 2016 20:05:53 +0000 (20:05 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 22 Jan 2016 20:05:53 +0000 (20:05 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15093 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mail_handler.rb

index dad13ebf89a7713d35322636b85aeed9560f0e5e..cff397a5259db34975f561ec9012188ed1e04439 100644 (file)
@@ -314,7 +314,7 @@ class MailHandler < ActionMailer::Base
   # Adds To and Cc as watchers of the given object if the sender has the
   # appropriate permission
   def add_watchers(obj)
-    if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project)
+    if handler_options[:no_permission_check] || user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project)
       addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase}
       unless addresses.empty?
         users = User.active.having_mail(addresses).to_a