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

18 lines
417 B
Ruby
Raw Normal View History

2023-03-17 16:20:25 +05:30
# 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