parent
7a95fb9d32
commit
9f40d2c93b
|
@ -30,15 +30,18 @@ class LDAPController(metaclass=Singleton):
|
||||||
raise PermissionDenied("Invalid Password or Username")
|
raise PermissionDenied("Invalid Password or Username")
|
||||||
|
|
||||||
def getUserData(self, username):
|
def getUserData(self, username):
|
||||||
self.connect()
|
try:
|
||||||
search_data = self.client.search_s('ou=user,{}'.format(self.dn), ldap.SCOPE_SUBTREE, 'uid={}'.format(username), ['uid', 'givenName', 'sn'])
|
self.connect()
|
||||||
retVal = search_data[0][1]
|
search_data = self.client.search_s('ou=user,{}'.format(self.dn), ldap.SCOPE_SUBTREE, 'uid={}'.format(username), ['uid', 'givenName', 'sn'])
|
||||||
for k,v in retVal.items():
|
retVal = search_data[0][1]
|
||||||
retVal[k] = v[0].decode('utf-8')
|
for k,v in retVal.items():
|
||||||
retVal['dn'] = self.dn
|
retVal[k] = v[0].decode('utf-8')
|
||||||
retVal['firstname'] = retVal['givenName']
|
retVal['dn'] = self.dn
|
||||||
retVal['lastname'] = retVal['sn']
|
retVal['firstname'] = retVal['givenName']
|
||||||
return retVal
|
retVal['lastname'] = retVal['sn']
|
||||||
|
return retVal
|
||||||
|
except:
|
||||||
|
raise PermissionDenied("No User exists with this uid.")
|
||||||
|
|
||||||
|
|
||||||
def getGroup(self, username):
|
def getGroup(self, username):
|
||||||
|
|
Loading…
Reference in New Issue