Esthetic fixes

This commit is contained in:
Théo Barnouin 2024-01-04 15:58:52 +01:00
parent d78359ca69
commit e3e9e79965

View file

@ -18,7 +18,6 @@ creds.set_password('Jps55Sk8An9y2nVL')
samdb = SamDB(url='/var/lib/samba/private/sam.ldb', session_info=system_session(),credentials=creds, lp=lp) samdb = SamDB(url='/var/lib/samba/private/sam.ldb', session_info=system_session(),credentials=creds, lp=lp)
data_file="user.json" data_file="user.json"
attributes_list = []
with open(data_file, "r") as file: with open(data_file, "r") as file:
ldap_users = json.load(file) ldap_users = json.load(file)
@ -36,7 +35,17 @@ with open(data_file, "r") as file:
smb_uid_number = ldap_users["params"]["attributes"]["uidNumber"] smb_uid_number = ldap_users["params"]["attributes"]["uidNumber"]
smb_gid_number = ldap_users["params"]["attributes"]["gidNumber"] smb_gid_number = ldap_users["params"]["attributes"]["gidNumber"]
samdb.newuser(username=smb_username,password=smb_passwd,givenname=smb_givenname,surname=smb_surname,homedirectory=smb_homedir,mailaddress=smb_mail,uidnumber=smb_uid_number,gidnumber=smb_gid_number,useusernameascn=True) samdb.newuser(
username=smb_username,
password=smb_passwd,
givenname=smb_givenname,
surname=smb_surname,
homedirectory=smb_homedir,
mailaddress=smb_mail,
uidnumber=smb_uid_number,
gidnumber=smb_gid_number,
useusernameascn=True
)
query = "(objectclass=user)" query = "(objectclass=user)"
result = samdb.search('DC=nantes,DC=omero-fbi,DC=fr', expression=query, scope=ldb.SCOPE_SUBTREE) result = samdb.search('DC=nantes,DC=omero-fbi,DC=fr', expression=query, scope=ldb.SCOPE_SUBTREE)