2019-01-17 12:40:37 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class BoardPolicy < BasePolicy
|
|
|
|
delegate { @subject.parent }
|
|
|
|
|
|
|
|
condition(:is_group_board) { @subject.group_board? }
|
2019-02-14 16:19:59 -05:00
|
|
|
condition(:is_project_board) { @subject.project_board? }
|
2019-01-17 12:40:37 -05:00
|
|
|
|
2019-02-14 16:19:59 -05:00
|
|
|
rule { is_project_board & can?(:read_project) }.enable :read_parent
|
2019-01-17 12:40:37 -05:00
|
|
|
|
|
|
|
rule { is_group_board & can?(:read_group) }.policy do
|
2019-02-14 16:19:59 -05:00
|
|
|
enable :read_parent
|
2019-01-17 12:40:37 -05:00
|
|
|
enable :read_milestone
|
|
|
|
enable :read_issue
|
|
|
|
end
|
|
|
|
end
|