diff --git a/geruecht/controller/databaseController/dbUserController.py b/geruecht/controller/databaseController/dbUserController.py index 08f2d9d..e88940a 100644 --- a/geruecht/controller/databaseController/dbUserController.py +++ b/geruecht/controller/databaseController/dbUserController.py @@ -38,7 +38,10 @@ class Base: retVal.initGeruechte(creditLists) if workgroups: retVal.workgroups = self.getWorkgroupsOfUser(retVal.id) - return retVal + if retVal.uid == username: + return retVal + else: + return None except Exception as err: traceback.print_exc() self.db.connection.rollback() diff --git a/geruecht/controller/ldapController.py b/geruecht/controller/ldapController.py index ca204b2..6769995 100644 --- a/geruecht/controller/ldapController.py +++ b/geruecht/controller/ldapController.py @@ -52,12 +52,15 @@ class LDAPController(metaclass=Singleton): 'dn': self.ldap.connection.response[0]['dn'], 'firstname': user['givenName'][0], 'lastname': user['sn'][0], - 'uid': username, + 'uid': user['uid'][0], } if user['mail']: retVal['mail'] = user['mail'][0] debug.debug("user is {{ {} }}".format(retVal)) - return retVal + if retVal['uid'] == username: + return retVal + else: + raise Exception() except: debug.warning("exception in get user data from ldap", exc_info=True) raise PermissionDenied("No User exists with this uid.")