add domain variable to return of expandbase function
This commit is contained in:
parent
92e2b393c8
commit
73dfce0a91
@ -23,6 +23,7 @@ class LUSER():
|
|||||||
organization = ''
|
organization = ''
|
||||||
dc = ''
|
dc = ''
|
||||||
dcfull = ''
|
dcfull = ''
|
||||||
|
domain = ''
|
||||||
|
|
||||||
# Find ou in base and set it as organization variable
|
# Find ou in base and set it as organization variable
|
||||||
for i in baselist:
|
for i in baselist:
|
||||||
@ -39,19 +40,21 @@ class LUSER():
|
|||||||
for i in baselist:
|
for i in baselist:
|
||||||
if i.split('=')[0] == 'dc':
|
if i.split('=')[0] == 'dc':
|
||||||
# if first dc, add it from dc variable
|
# if first dc, add it from dc variable
|
||||||
if dcfull == '':
|
if dcfull == '' and domain='':
|
||||||
dcfull = f'dc={dc}'
|
dcfull = f'dc={dc}'
|
||||||
|
domain = dc
|
||||||
else:
|
else:
|
||||||
dcfull += ',dc=' + i.split('=')[1]
|
dcfull += ',dc=' + i.split('=')[1]
|
||||||
|
domain += f'.{i.split('=')[1]}'
|
||||||
|
|
||||||
return organization, dc, dcfull
|
return organization, dc, dcfull, domain
|
||||||
|
|
||||||
def __init__(self, ldap_host, admin_user, admin_pass, base, basealt='', autoconnect=True):
|
def __init__(self, ldap_host, admin_user, admin_pass, base, basealt='', autoconnect=True):
|
||||||
self.ldap_host = ldap_host
|
self.ldap_host = ldap_host
|
||||||
self.admin_user = admin_user
|
self.admin_user = admin_user
|
||||||
self.admin_pass = admin_pass
|
self.admin_pass = admin_pass
|
||||||
self.base = base
|
self.base = base
|
||||||
self.organization, self.dc, self.dcfull = self.expandbase()
|
self.organization, self.dc, self.dcfull, domain = self.expandbase()
|
||||||
self.basealt = basealt
|
self.basealt = basealt
|
||||||
self.alt = True
|
self.alt = True
|
||||||
self.autoconnect = autoconnect
|
self.autoconnect = autoconnect
|
||||||
|
Loading…
Reference in New Issue
Block a user