synchronisations mit Ldap
wenn userlänge des ldap nicht mit der der datenbank übereinstimmt wird die datenbank mit dem ldap synchronisiert.
This commit is contained in:
parent
93fcbe72ae
commit
7d19c13071
|
@ -9,6 +9,8 @@ from geruecht.model.user import User
|
|||
class Base:
|
||||
def getCreditListFromUser(self, user, **kwargs):
|
||||
try:
|
||||
if user.uid == 'extern':
|
||||
return []
|
||||
cursor = self.db.connection.cursor()
|
||||
if 'year' in kwargs:
|
||||
sql = "select * from creditList where user_id={} and year_date={}".format(user.id if type(user) is User else user, kwargs['year'])
|
||||
|
|
|
@ -78,8 +78,16 @@ class Base:
|
|||
debug.debug("updated config of user is {{ {} }}".format(retVal))
|
||||
return retVal
|
||||
|
||||
def syncLdap(self):
|
||||
debug.info('sync Users from Ldap')
|
||||
ldap_users = ldap.getAllUser()
|
||||
for user in ldap_users:
|
||||
self.getUser(user['username'])
|
||||
|
||||
def getAllUsersfromDB(self, extern=True):
|
||||
debug.info("get all users from database")
|
||||
if (len(ldap.getAllUser()) != len(db.getAllUser())):
|
||||
self.syncLdap()
|
||||
users = db.getAllUser()
|
||||
debug.debug("users are {{ {} }}".format(users))
|
||||
for user in users:
|
||||
|
|
Loading…
Reference in New Issue