Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies/work_item_policy.rb')
-rw-r--r--app/policies/work_item_policy.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/policies/work_item_policy.rb b/app/policies/work_item_policy.rb
index e191e8d26ca..ea7559592e1 100644
--- a/app/policies/work_item_policy.rb
+++ b/app/policies/work_item_policy.rb
@@ -8,4 +8,9 @@ class WorkItemPolicy < IssuePolicy
rule { can?(:update_issue) }.enable :update_work_item
rule { can?(:read_issue) }.enable :read_work_item
+ # because IssuePolicy delegates to ProjectPolicy and
+ # :read_work_item is enabled in ProjectPolicy too, we
+ # need to make sure we also prevent this rule if read_issue
+ # is prevented
+ rule { ~can?(:read_issue) }.prevent :read_work_item
end