Role-based issue custom field visibility (#5037).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12012 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2013-07-13 09:20:11 +00:00
1 parent a74d55edd9
commit 628d05629b
41 files changed
+953 -121

No files matched your search

+24 -4
View File
@@ -53,6 +53,18 @@ class Journal < ActiveRecord::Base
(details.empty? && notes.blank?) ? false : super
end
def visible_details(user=User.current)
details.select do |detail|
if detail.property == 'cf'
field_id = detail.prop_key
field = CustomField.find_by_id(field_id)
field && field.visible_by?(project, user)
else
true
end
end
end
# Returns the new status if the journal contains a status change, otherwise nil
def new_status
c = details.detect {|detail| detail.prop_key == 'status_id'}
@@ -93,20 +105,28 @@ class Journal < ActiveRecord::Base
@notify = arg
end
def recipients
def notified_users
notified = journalized.notified_users
if private_notes?
notified = notified.select {|user| user.allowed_to?(:view_private_notes, journalized.project)}
end
notified.map(&:mail)
notified
end
def watcher_recipients
def recipients
notified_users.map(&:mail)
end
def notified_watchers
notified = journalized.notified_watchers
if private_notes?
notified = notified.select {|user| user.allowed_to?(:view_private_notes, journalized.project)}
end
notified.map(&:mail)
notified
end
def watcher_recipients
notified_watchers.map(&:mail)
end
private