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

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

35 lines
905 B
Ruby
Raw Normal View History

2019-03-02 22:35:43 +05:30
# frozen_string_literal: true
class BoardPolicy < BasePolicy
2019-12-04 20:38:33 +05:30
include FindGroupProjects
2019-12-21 20:55:43 +05:30
delegate { @subject.resource_parent }
2019-03-02 22:35:43 +05:30
condition(:is_group_board) { @subject.group_board? }
condition(:is_project_board) { @subject.project_board? }
rule { is_project_board & can?(:read_project) }.enable :read_parent
rule { is_group_board & can?(:read_group) }.policy do
enable :read_parent
enable :read_milestone
enable :read_issue
end
2019-12-04 20:38:33 +05:30
condition(:reporter_of_group_projects) do
next unless @user
2019-12-21 20:55:43 +05:30
group_projects_for(user: @user, group: @subject.resource_parent)
2019-12-04 20:38:33 +05:30
.visible_to_user_and_access_level(@user, ::Gitlab::Access::REPORTER)
.exists?
end
rule { is_group_board & reporter_of_group_projects }.policy do
enable :create_non_backlog_issues
end
rule { is_project_board & can?(:admin_issue) }.policy do
enable :create_non_backlog_issues
end
2019-03-02 22:35:43 +05:30
end