diff options
Diffstat (limited to 'app/policies/work_item_policy.rb')
-rw-r--r-- | app/policies/work_item_policy.rb | 12 |
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 |