def user_pre_delete(**kwargs): """ Delete users's LDAP account. """ user = kwargs['instance'] ldap_account = get_ldap_account_safely(user) if ldap_account: delete_ldap_account(ldap_account)
def clean_up_accounts(self): to_delete = LDAPAccountStatus.objects.filter(user=None) for ldap_account in to_delete: self.stdout.write("Deleting orphaned account '{}'...".format( ldap_account.ldap_dn)) delete_ldap_account(ldap_account)
def clean_up_accounts(self): to_delete = LDAPAccountStatus.objects.filter(user=None) for ldap_account in to_delete: self.stdout.write("Deleting orphaned account '{}'...".format(ldap_account.ldap_dn)) delete_ldap_account(ldap_account)