Extract hook methods from group policies with EE-specific implementation

parent 657da7b4
......@@ -16,8 +16,11 @@ class GroupMemberPolicy < BasePolicy
can! :destroy_group_member
end
# EE-only
can_override = Ability.allowed?(@user, :override_group_member, group)
additional_rules!
end
def additional_rules!
can_override = Ability.allowed?(@user, :override_group_member, @subject.group)
if can_override
can! :override_group_member if @subject.ldap?
......
......@@ -34,11 +34,7 @@ class GroupPolicy < BasePolicy
can! :request_access
end
# EE-only
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if owner
end
additional_rules!(master)
end
def can_read_group?
......@@ -49,4 +45,11 @@ class GroupPolicy < BasePolicy
GroupProjectsFinder.new(@subject).execute(@user).any?
end
def additional_rules!(master)
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if master
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment