try to update userdata in database from ldap when getAllUsersFromDB is executed
This commit is contained in:
parent
80fbe2b759
commit
358826e8c4
|
@ -38,8 +38,10 @@ class LDAPController(metaclass=Singleton):
|
|||
'dn': self.ldap.connection.response[0]['dn'],
|
||||
'firstname': user['givenName'][0],
|
||||
'lastname': user['sn'][0],
|
||||
'uid': username
|
||||
'uid': username,
|
||||
}
|
||||
if user['mail']:
|
||||
retVal['mail'] = user['mail'][0]
|
||||
return retVal
|
||||
except:
|
||||
raise PermissionDenied("No User exists with this uid.")
|
||||
|
|
|
@ -110,6 +110,14 @@ class UserController(metaclass=Singleton):
|
|||
db.updateUser(user)
|
||||
return self.getUser(username)
|
||||
|
||||
def __updateDataFromLDAP(self, user):
|
||||
groups = ldap.getGroup(user.uid)
|
||||
user_data = ldap.getUserData(user.uid)
|
||||
user_data['gruppe'] = groups
|
||||
user_data['group'] = groups
|
||||
user.updateData(user_data)
|
||||
db.updateUser(user)
|
||||
|
||||
def autoLock(self, user):
|
||||
if user.autoLock:
|
||||
if user.getGeruecht(year=datetime.now().year).getSchulden() <= (-1*user.limit):
|
||||
|
@ -141,6 +149,10 @@ class UserController(metaclass=Singleton):
|
|||
def getAllUsersfromDB(self):
|
||||
users = db.getAllUser()
|
||||
for user in users:
|
||||
try:
|
||||
self.__updateDataFromLDAP(user)
|
||||
except:
|
||||
pass
|
||||
self.__updateGeruechte(user)
|
||||
return db.getAllUser()
|
||||
|
||||
|
|
Loading…
Reference in New Issue