fixed ##261

hier wird nun der username auf casesensitiv überprüft.
This commit is contained in:
Tim Gröger 2020-06-05 23:43:16 +02:00
parent 7d19c13071
commit 18785dad91
2 changed files with 9 additions and 3 deletions

View File

@ -38,7 +38,10 @@ class Base:
retVal.initGeruechte(creditLists) retVal.initGeruechte(creditLists)
if workgroups: if workgroups:
retVal.workgroups = self.getWorkgroupsOfUser(retVal.id) retVal.workgroups = self.getWorkgroupsOfUser(retVal.id)
if retVal.uid == username:
return retVal return retVal
else:
return None
except Exception as err: except Exception as err:
traceback.print_exc() traceback.print_exc()
self.db.connection.rollback() self.db.connection.rollback()

View File

@ -52,12 +52,15 @@ class LDAPController(metaclass=Singleton):
'dn': self.ldap.connection.response[0]['dn'], 'dn': self.ldap.connection.response[0]['dn'],
'firstname': user['givenName'][0], 'firstname': user['givenName'][0],
'lastname': user['sn'][0], 'lastname': user['sn'][0],
'uid': username, 'uid': user['uid'][0],
} }
if user['mail']: if user['mail']:
retVal['mail'] = user['mail'][0] retVal['mail'] = user['mail'][0]
debug.debug("user is {{ {} }}".format(retVal)) debug.debug("user is {{ {} }}".format(retVal))
if retVal['uid'] == username:
return retVal return retVal
else:
raise Exception()
except: except:
debug.warning("exception in get user data from ldap", exc_info=True) debug.warning("exception in get user data from ldap", exc_info=True)
raise PermissionDenied("No User exists with this uid.") raise PermissionDenied("No User exists with this uid.")