summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 06:13:09 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-24 06:13:09 +0000
commit89bfc148f90c410512f9c470ca1e50485b7000b2 (patch)
tree9ff12f0c281483cd24585ae9fc5acc4be6a90ac9 /app/policies
parentdf6d6623faac958bea9787a1cda4259cbcdc1287 (diff)
downloadgitlab-ce-89bfc148f90c410512f9c470ca1e50485b7000b2.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/project_policy.rb2
-rw-r--r--app/policies/work_item_policy.rb11
2 files changed, 4 insertions, 9 deletions
diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb
index 4cc5ed06d61..147ca9c9881 100644
--- a/app/policies/project_policy.rb
+++ b/app/policies/project_policy.rb
@@ -264,8 +264,6 @@ class ProjectPolicy < BasePolicy
enable :create_work_item
end
- rule { can?(:update_issue) }.enable :update_work_item
-
# These abilities are not allowed to admins that are not members of the project,
# that's why they are defined separately.
rule { guest & can?(:download_code) }.enable :build_download_code
diff --git a/app/policies/work_item_policy.rb b/app/policies/work_item_policy.rb
index 7ba5102a406..b4723bc7ed8 100644
--- a/app/policies/work_item_policy.rb
+++ b/app/policies/work_item_policy.rb
@@ -1,12 +1,9 @@
# frozen_string_literal: true
-class WorkItemPolicy < BasePolicy
- delegate { @subject.project }
+class WorkItemPolicy < IssuePolicy
+ rule { can?(:owner_access) | is_author }.enable :delete_work_item
- desc 'User is author of the work item'
- condition(:author) do
- @user && @user == @subject.author
- end
+ rule { can?(:update_issue) }.enable :update_work_item
- rule { can?(:owner_access) | author }.enable :delete_work_item
+ rule { can?(:read_issue) }.enable :read_work_item
end