debian-mirror-gitlab/app/policies/project_group_link_policy.rb
2023-03-17 16:20:25 +05:30

17 lines
417 B
Ruby

# frozen_string_literal: true
class ProjectGroupLinkPolicy < BasePolicy # rubocop:disable Gitlab/NamespacedClass
condition(:group_owner_or_project_admin) { group_owner? || project_admin? }
rule { group_owner_or_project_admin }.enable :admin_project_group_link
private
def group_owner?
can?(:admin_group, @subject.group)
end
def project_admin?
can?(:admin_project, @subject.project)
end
end