Disallow deletion of global password policy.

ticket 1936
This commit is contained in:
Jan Cholasta
2011-10-11 14:28:17 +02:00
committed by Martin Kosek
parent 89b869d2c2
commit c0879cd00b
2 changed files with 21 additions and 0 deletions

View File

@@ -366,6 +366,14 @@ class pwpolicy_del(LDAPDelete):
attribute=True, required=True, multivalue=True
)
def pre_callback(self, ldap, dn, *keys, **options):
if dn.lower() == global_policy_dn.lower():
raise errors.ValidationError(
name='group',
error=_('cannot delete global password policy')
)
return dn
def post_callback(self, ldap, dn, *keys, **options):
try:
self.api.Command.cosentry_del(keys[-1])