Fix edit issue notes permission #888

This commit is contained in:
Felix Schäfer 2012-03-02 01:38:03 +01:00 committed by Felix Schäfer
parent 724bd48494
commit 2c76240544
3 changed files with 11 additions and 2 deletions

View File

@ -707,6 +707,15 @@ class Issue < ActiveRecord::Base
projects
end
# Overrides Redmine::Acts::Journalized::Permissions
#
# The default assumption is that journals have the same permissions
# as the journaled object, issue notes have separate permissions though
def journal_editable_by?(journal, user)
return true if journal.author == user && user.allowed_to?(:edit_own_issue_notes, project)
user.allowed_to? :edit_issue_notes, project
end
private
def update_nested_set_attributes

View File

@ -76,7 +76,7 @@ class Journal < ActiveRecord::Base
end
def editable_by?(user)
journaled.journal_editable_by?(user)
journaled.journal_editable_by?(self, user)
end
def details

View File

@ -22,7 +22,7 @@ module Redmine::Acts::Journalized
module Permissions
# Default implementation of journal editing permission
# Is overridden if defined in the journalized model directly
def journal_editable_by?(user)
def journal_editable_by?(journal, user)
return true if user.admin?
if respond_to? :editable_by?
editable_by? user