bugfix ldap init

This commit is contained in:
root 2013-07-06 15:27:24 +00:00
parent 88475daa83
commit 2d70cdd831

View file

@ -39,6 +39,30 @@ def tools_ldapinit():
"""
with YunoHostLDAP() as yldap:
with open('ldap_scheme.yml') as f:
ldap_map = yaml.load(f)
for rdn, attr_dict in ldap_map['parents'].items():
yldap.add(rdn, attr_dict)
for rdn, attr_dict in ldap_map['children'].items():
yldap.add(rdn, attr_dict)
admin_dict = {
'cn': 'admin',
'uid': 'admin',
'description': 'LDAP Administrator',
'gidNumber': '1007',
'uidNumber': '1007',
'homeDirectory': '/home/admin',
'loginShell': '/bin/bash',
'objectClass': ['organizationalRole', 'posixAccount', 'simpleSecurityObject']
}
yldap.update('cn=admin', admin_dict)
os.system('rm /etc/smbldap-tools/smbldap_bind.conf')
with open('/etc/smbldap-tools/smbldap_bind.conf', 'w') as f:
lines = [
@ -59,32 +83,6 @@ def tools_ldapinit():
os.system('smbldap-populate')
# TODO: change root domain password
with YunoHostLDAP() as yldap:
with open('ldap_scheme.yml') as f:
ldap_map = yaml.load(f)
for rdn, attr_dict in ldap_map['parents'].items():
pass
#yldap.add(rdn, attr_dict)
for rdn, attr_dict in ldap_map['children'].items():
pass
#yldap.add(rdn, attr_dict)
admin_dict = {
'cn': 'admin',
'uid': 'admin',
'description': 'LDAP Administrator',
'gidNumber': '1007',
'uidNumber': '1007',
'homeDirectory': '/home/admin',
'loginShell': '/bin/bash',
'objectClass': ['organizationalRole', 'posixAccount', 'simpleSecurityObject']
}
#yldap.update('cn=admin', admin_dict)
win_msg(_("LDAP has been successfully initialized"))