Makes relations resource shallow (#7366).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6184 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-07-05 16:47:34 +00:00
parent 852cb183b1
commit 42f9dc7d2c
8 changed files with 41 additions and 29 deletions
+10
View File
@@ -43,6 +43,16 @@ class IssueRelation < ActiveRecord::Base
attr_protected :issue_from_id, :issue_to_id
def visible?(user=User.current)
(issue_from.nil? || issue_from.visible?(user)) && (issue_to.nil? || issue_to.visible?(user))
end
def deletable?(user=User.current)
visible?(user) &&
((issue_from.nil? || user.allowed_to?(:manage_issue_relations, issue_from.project)) ||
(issue_to.nil? || user.allowed_to?(:manage_issue_relations, issue_to.project)))
end
def after_initialize
if new_record?
if relation_type.blank?