Fix edit issue notes permission #888
This commit is contained in:
parent
724bd48494
commit
2c76240544
@ -707,6 +707,15 @@ class Issue < ActiveRecord::Base
|
|||||||
projects
|
projects
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def update_nested_set_attributes
|
def update_nested_set_attributes
|
||||||
|
@ -76,7 +76,7 @@ class Journal < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def editable_by?(user)
|
def editable_by?(user)
|
||||||
journaled.journal_editable_by?(user)
|
journaled.journal_editable_by?(self, user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def details
|
def details
|
||||||
|
@ -22,7 +22,7 @@ module Redmine::Acts::Journalized
|
|||||||
module Permissions
|
module Permissions
|
||||||
# Default implementation of journal editing permission
|
# Default implementation of journal editing permission
|
||||||
# Is overridden if defined in the journalized model directly
|
# 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?
|
return true if user.admin?
|
||||||
if respond_to? :editable_by?
|
if respond_to? :editable_by?
|
||||||
editable_by? user
|
editable_by? user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user