debian-mirror-gitlab/app/policies/work_item_policy.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
657 B
Ruby
Raw Normal View History

2022-04-04 11:22:00 +05:30
# frozen_string_literal: true
2022-05-07 20:08:51 +05:30
class WorkItemPolicy < IssuePolicy
2022-07-16 23:28:13 +05:30
condition(:is_member_and_author) { is_project_member? & is_author? }
rule { can?(:destroy_issue) | is_member_and_author }.enable :delete_work_item
2022-04-04 11:22:00 +05:30
2022-05-07 20:08:51 +05:30
rule { can?(:update_issue) }.enable :update_work_item
2022-04-04 11:22:00 +05:30
2022-05-07 20:08:51 +05:30
rule { can?(:read_issue) }.enable :read_work_item
2022-07-23 23:45:48 +05:30
# 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
2022-08-13 15:12:31 +05:30
rule { can?(:reporter_access) }.policy do
enable :admin_parent_link
end
2022-04-04 11:22:00 +05:30
end