testing making dict for sql table

This commit is contained in:
2021-11-02 11:06:33 -04:00
parent d561010171
commit b5af6030ca

View File

@@ -163,12 +163,17 @@ logger.debug("Starting SQL query for LDAPUsers")
query = ("SELECT * FROM LDAPUsers") query = ("SELECT * FROM LDAPUsers")
logger.debug("Query: {0}".format(query)) logger.debug("Query: {0}".format(query))
cursor.execute(query) cursor.execute(query)
sqlLDAPusers = cursor.fetchall() results = cursor.fetchall()
logger.debug("Found {0} SQL LDAP users".format(cursor.rowcount)) 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]))) 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") 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 # 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 not in the sql table, insert a new row to add them
# if they are disabled in the sql table, enable them # if they are disabled in the sql table, enable them