Add admin ldap setting policy rule

parent 46fb3939
...@@ -134,8 +134,10 @@ module EE ...@@ -134,8 +134,10 @@ module EE
rule { admin | owner }.enable :admin_group_saml rule { admin | owner }.enable :admin_group_saml
rule { admin | (can_owners_manage_ldap & owner) }.enable :admin_ldap_group_links rule { admin | (can_owners_manage_ldap & owner) }.policy do
enable :admin_ldap_group_links
enable :admin_ldap_group_settings
end
rule { ldap_synced & ~owners_bypass_ldap_lock }.prevent :admin_group_member rule { ldap_synced & ~owners_bypass_ldap_lock }.prevent :admin_group_member
......
...@@ -273,6 +273,7 @@ describe GroupPolicy do ...@@ -273,6 +273,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_allowed(:admin_ldap_group_links) } it { is_expected.to be_allowed(:admin_ldap_group_links) }
it { is_expected.to be_allowed(:admin_ldap_group_settings) }
context 'does not allow group owners to manage ldap' do context 'does not allow group owners to manage ldap' do
before do before do
...@@ -280,6 +281,7 @@ describe GroupPolicy do ...@@ -280,6 +281,7 @@ describe GroupPolicy do
end end
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
end end
...@@ -288,6 +290,7 @@ describe GroupPolicy do ...@@ -288,6 +290,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_allowed(:admin_ldap_group_links) } it { is_expected.to be_allowed(:admin_ldap_group_links) }
it { is_expected.to be_allowed(:admin_ldap_group_settings) }
end end
end end
...@@ -301,6 +304,7 @@ describe GroupPolicy do ...@@ -301,6 +304,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
context 'guests' do context 'guests' do
...@@ -308,6 +312,7 @@ describe GroupPolicy do ...@@ -308,6 +312,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
context 'reporter' do context 'reporter' do
...@@ -315,6 +320,7 @@ describe GroupPolicy do ...@@ -315,6 +320,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
context 'developer' do context 'developer' do
...@@ -322,6 +328,7 @@ describe GroupPolicy do ...@@ -322,6 +328,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
context 'maintainer' do context 'maintainer' do
...@@ -329,6 +336,7 @@ describe GroupPolicy do ...@@ -329,6 +336,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
context 'owner' do context 'owner' do
...@@ -345,6 +353,7 @@ describe GroupPolicy do ...@@ -345,6 +353,7 @@ describe GroupPolicy do
it { is_expected.to be_disallowed(:override_group_member) } it { is_expected.to be_disallowed(:override_group_member) }
it { is_expected.to be_disallowed(:admin_ldap_group_links) } it { is_expected.to be_disallowed(:admin_ldap_group_links) }
it { is_expected.to be_disallowed(:admin_ldap_group_settings) }
end end
end end
...@@ -353,6 +362,7 @@ describe GroupPolicy do ...@@ -353,6 +362,7 @@ describe GroupPolicy do
it { is_expected.to be_allowed(:override_group_member) } it { is_expected.to be_allowed(:override_group_member) }
it { is_expected.to be_allowed(:admin_ldap_group_links) } it { is_expected.to be_allowed(:admin_ldap_group_links) }
it { is_expected.to be_allowed(:admin_ldap_group_settings) }
end end
context 'when memberships locked to LDAP' do context 'when memberships locked to LDAP' do
......
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