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.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/policies/work_item_policy.rb b/app/policies/work_item_policy.rb
new file mode 100644
index 00000000000..7ba5102a406
--- /dev/null
+++ b/app/policies/work_item_policy.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class WorkItemPolicy < BasePolicy
+ delegate { @subject.project }
+
+ desc 'User is author of the work item'
+ condition(:author) do
+ @user && @user == @subject.author
+ end
+
+ rule { can?(:owner_access) | author }.enable :delete_work_item
+end