From b5af6030ca4383443619d2838bbcdc3b0da9bca7 Mon Sep 17 00:00:00 2001 From: John Gaunt Date: Tue, 2 Nov 2021 11:06:33 -0400 Subject: [PATCH] testing making dict for sql table --- seafile-ldap.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/seafile-ldap.py b/seafile-ldap.py index d4cdf90..5f8e650 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -163,12 +163,17 @@ logger.debug("Starting SQL query for LDAPUsers") query = ("SELECT * FROM LDAPUsers") logger.debug("Query: {0}".format(query)) cursor.execute(query) -sqlLDAPusers = cursor.fetchall() +results = cursor.fetchall() logger.debug("Found {0} SQL LDAP users".format(cursor.rowcount)) -for user in sqlLDAPusers: +sqlLDAPusers = [] +for user in results: logger.debug("User: {0} - Active: {1}".format(user[1], bool(user[4]))) + temp['email'] = user[1] + temp['is_active'] = user[4] + sqlLDAPusers.append(temp) logger.debug("Finished SQL query for LDAPUsers") - +print(sqlLDAPusers) +exit() # Loop through the ldap users and make sure they are in the sql ldap users table # if they are not in the sql table, insert a new row to add them # if they are disabled in the sql table, enable them