|
|
|
@ -52,17 +52,23 @@ module Redmine::Acts::Journalized |
|
|
|
|
# Is overridden if defined in the journalized model directly |
|
|
|
|
def journal_editable_by?(user) |
|
|
|
|
return true if user.admin? |
|
|
|
|
|
|
|
|
|
if respond_to? :editable_by? |
|
|
|
|
editable_by? user |
|
|
|
|
else |
|
|
|
|
permission = if respond_to? :journal_permission |
|
|
|
|
journal_permission |
|
|
|
|
else |
|
|
|
|
:"edit_#{self.class.to_s.pluralize.underscore}" |
|
|
|
|
end |
|
|
|
|
p = @project || (project if respond_to? :project) |
|
|
|
|
options = { global: p.present? } |
|
|
|
|
user.allowed_to? permission, p, options |
|
|
|
|
user.allowed_to? journable_edit_permission, p, options |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
private |
|
|
|
|
|
|
|
|
|
def journable_edit_permission |
|
|
|
|
if respond_to? :journal_permission |
|
|
|
|
journal_permission |
|
|
|
|
else |
|
|
|
|
:"edit_#{self.class.to_s.pluralize.underscore}" |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|