Makes MailHandler accept all issue attributes and custom fields that can be set/updated (#4071, #4807, #5622, #6110).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4394 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
0eb7d8f614
commit
e0e8c14c2a
5 files changed
+60
-51
No files matched your search
+7
-4
@@ -248,19 +248,22 @@ class Issue < ActiveRecord::Base
|
||||
def safe_attributes=(attrs, user=User.current)
|
||||
return unless attrs.is_a?(Hash)
|
||||
|
||||
new_statuses_allowed = new_statuses_allowed_to(user)
|
||||
|
||||
# User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
|
||||
if new_record? || user.allowed_to?(:edit_issues, project)
|
||||
attrs = attrs.reject {|k,v| !SAFE_ATTRIBUTES.include?(k)}
|
||||
elsif new_statuses_allowed.any?
|
||||
elsif new_statuses_allowed_to(user).any?
|
||||
attrs = attrs.reject {|k,v| !SAFE_ATTRIBUTES_ON_TRANSITION.include?(k)}
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
# Tracker must be set before since new_statuses_allowed_to depends on it.
|
||||
if t = attrs.delete('tracker_id')
|
||||
self.tracker_id = t
|
||||
end
|
||||
|
||||
if attrs['status_id']
|
||||
unless new_statuses_allowed.collect(&:id).include?(attrs['status_id'].to_i)
|
||||
unless new_statuses_allowed_to(user).collect(&:id).include?(attrs['status_id'].to_i)
|
||||
attrs.delete('status_id')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user