2022-02-01 00:14:06 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-02-24 06:13:09 +00:00
|
|
|
class WorkItemPolicy < IssuePolicy
|
2022-05-17 06:08:24 +00:00
|
|
|
condition(:is_member_and_author) { is_project_member? & is_author? }
|
|
|
|
|
|
|
|
rule { can?(:destroy_issue) | is_member_and_author }.enable :delete_work_item
|
2022-02-01 18:17:05 +00:00
|
|
|
|
2022-02-24 06:13:09 +00:00
|
|
|
rule { can?(:update_issue) }.enable :update_work_item
|
2022-02-01 18:17:05 +00:00
|
|
|
|
2022-02-24 06:13:09 +00:00
|
|
|
rule { can?(:read_issue) }.enable :read_work_item
|
2022-06-08 12:08:46 +00:00
|
|
|
# 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-07-15 15:15:01 +00:00
|
|
|
|
|
|
|
rule { can?(:reporter_access) }.policy do
|
|
|
|
enable :admin_parent_link
|
|
|
|
end
|
2022-02-01 00:14:06 +00:00
|
|
|
end
|