2022-01-31 19:14:06 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-02-24 01:13:09 -05:00
|
|
|
class WorkItemPolicy < IssuePolicy
|
2022-05-17 02:08:24 -04: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 13:17:05 -05:00
|
|
|
|
2022-02-24 01:13:09 -05:00
|
|
|
rule { can?(:update_issue) }.enable :update_work_item
|
2022-02-01 13:17:05 -05:00
|
|
|
|
2022-02-24 01:13:09 -05:00
|
|
|
rule { can?(:read_issue) }.enable :read_work_item
|
2022-06-08 08:08:46 -04: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-01-31 19:14:06 -05:00
|
|
|
end
|