Extract hook methods from group policies with EE-specific implementation

parent 657da7b4
...@@ -16,8 +16,11 @@ class GroupMemberPolicy < BasePolicy ...@@ -16,8 +16,11 @@ class GroupMemberPolicy < BasePolicy
can! :destroy_group_member can! :destroy_group_member
end end
# EE-only additional_rules!
can_override = Ability.allowed?(@user, :override_group_member, group) end
def additional_rules!
can_override = Ability.allowed?(@user, :override_group_member, @subject.group)
if can_override if can_override
can! :override_group_member if @subject.ldap? can! :override_group_member if @subject.ldap?
......
...@@ -34,11 +34,7 @@ class GroupPolicy < BasePolicy ...@@ -34,11 +34,7 @@ class GroupPolicy < BasePolicy
can! :request_access can! :request_access
end end
# EE-only additional_rules!(master)
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if owner
end
end end
def can_read_group? def can_read_group?
...@@ -49,4 +45,11 @@ class GroupPolicy < BasePolicy ...@@ -49,4 +45,11 @@ class GroupPolicy < BasePolicy
GroupProjectsFinder.new(@subject).execute(@user).any? GroupProjectsFinder.new(@subject).execute(@user).any?
end end
def additional_rules!(master)
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if master
end
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