Add delete_user
This commit is contained in:
parent
a909a9b5c5
commit
4e9493f198
1 changed files with 21 additions and 0 deletions
|
@ -200,6 +200,27 @@ class LdapManager:
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
return result, entries
|
return result, entries
|
||||||
|
|
||||||
|
def delete_user(self, uid):
|
||||||
|
"""
|
||||||
|
Deletes the user with the given uid from ldap
|
||||||
|
|
||||||
|
:param uid: str representing the user
|
||||||
|
:return: True if the delete was successful False otherwise
|
||||||
|
"""
|
||||||
|
conn = self.get_admin_conn()
|
||||||
|
try:
|
||||||
|
return_val = conn.delete(
|
||||||
|
("uid={uid}," + settings.LDAP_CUSTOMER_DN).format(uid=uid),
|
||||||
|
)
|
||||||
|
msg = "success"
|
||||||
|
except Exception as ex:
|
||||||
|
msg = str(ex)
|
||||||
|
logger.error("Exception: " + msg)
|
||||||
|
return_val = False
|
||||||
|
finally:
|
||||||
|
conn.unbind()
|
||||||
|
return return_val, msg
|
||||||
|
|
||||||
def _set_max_uid(self, max_uid):
|
def _set_max_uid(self, max_uid):
|
||||||
"""
|
"""
|
||||||
a utility function to save max_uid value to a file
|
a utility function to save max_uid value to a file
|
||||||
|
|
Loading…
Reference in a new issue