summaryrefslogtreecommitdiff
path: root/app/policies/issue_policy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/issue_policy.rb')
-rw-r--r--app/policies/issue_policy.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/policies/issue_policy.rb b/app/policies/issue_policy.rb
index 575e532c615..c9c13b29643 100644
--- a/app/policies/issue_policy.rb
+++ b/app/policies/issue_policy.rb
@@ -12,6 +12,9 @@ class IssuePolicy < IssuablePolicy
@user && IssueCollection.new([@subject]).visible_to(@user).any?
end
+ desc "User can read contacts belonging to the issue group"
+ condition(:can_read_crm_contacts, scope: :subject) { @user.can?(:read_crm_contact, @subject.project.group) }
+
desc "Issue is confidential"
condition(:confidential, scope: :subject) { @subject.confidential? }
@@ -77,6 +80,10 @@ class IssuePolicy < IssuablePolicy
rule { ~persisted & can?(:create_issue) }.policy do
enable :set_confidentiality
end
+
+ rule { can?(:set_issue_metadata) & can_read_crm_contacts }.policy do
+ enable :set_issue_crm_contacts
+ end
end
IssuePolicy.prepend_mod_with('IssuePolicy')