python libs
This commit is contained in:
@@ -108,3 +108,17 @@ class Ldap:
|
||||
return True
|
||||
|
||||
|
||||
def update_user(self, email, field, value):
|
||||
"""
|
||||
Mettre à jour un champ.
|
||||
"""
|
||||
if not validate_email(email):
|
||||
return False
|
||||
|
||||
# Construire le DN
|
||||
dn = f"cn={email},ou=users,{self.ldap_root}"
|
||||
|
||||
mod_attrs = [(ldap.MOD_REPLACE, field, value)]
|
||||
|
||||
self.ldap_connection.modify_s(dn, mod_attrs)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user