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:
|
class Base:
|
||||||
def getCreditListFromUser(self, user, **kwargs):
|
def getCreditListFromUser(self, user, **kwargs):
|
||||||
try:
|
try:
|
||||||
|
if user.uid == 'extern':
|
||||||
|
return []
|
||||||
cursor = self.db.connection.cursor()
|
cursor = self.db.connection.cursor()
|
||||||
if 'year' in kwargs:
|
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'])
|
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))
|
debug.debug("updated config of user is {{ {} }}".format(retVal))
|
||||||
return 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):
|
def getAllUsersfromDB(self, extern=True):
|
||||||
debug.info("get all users from database")
|
debug.info("get all users from database")
|
||||||
|
if (len(ldap.getAllUser()) != len(db.getAllUser())):
|
||||||
|
self.syncLdap()
|
||||||
users = db.getAllUser()
|
users = db.getAllUser()
|
||||||
debug.debug("users are {{ {} }}".format(users))
|
debug.debug("users are {{ {} }}".format(users))
|
||||||
for user in users:
|
for user in users:
|
||||||
|
|
Loading…
Reference in New Issue