diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-05 16:47:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-05 16:47:34 +0000 |
commit | 42f9dc7d2c5ac27b538ad5f33fcb132437ed5975 (patch) | |
tree | e69bf7daf18819f26779cd267c300a7e669eee65 /app/models/issue_relation.rb | |
parent | 852cb183b184f65e352f2619250782f6de7dbfd9 (diff) | |
download | redmine-42f9dc7d2c5ac27b538ad5f33fcb132437ed5975.tar.gz redmine-42f9dc7d2c5ac27b538ad5f33fcb132437ed5975.zip |
Makes relations resource shallow (#7366).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6184 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_relation.rb')
-rw-r--r-- | app/models/issue_relation.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index 5b050c9a3..2d5086332 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -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? |