I think i got it now, the row count needed to be after the fetchall
This commit is contained in:
@@ -166,12 +166,12 @@ for ldapUser in ldapUsers:
|
|||||||
logger.debug("Checking if LDAP user {0} is in SQl Table".format(ldapUser.mail))
|
logger.debug("Checking if LDAP user {0} is in SQl Table".format(ldapUser.mail))
|
||||||
cnx = mysql.connector.connect(**dbconfig)
|
cnx = mysql.connector.connect(**dbconfig)
|
||||||
cursor = cnx.cursor()
|
cursor = cnx.cursor()
|
||||||
query = "SELECT * FROM LDAPUsers WHERE is_staff = 1".format(ldapUser.mail)
|
query = "SELECT * FROM LDAPUsers WHERE email = '{0}'".format(ldapUser.mail)
|
||||||
logger.debug("Query: {0}".format(query))
|
logger.debug("Query: {0}".format(query))
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
|
sqlLDAPuser = cursor.fetchall()
|
||||||
row_count = cursor.rowcount
|
row_count = cursor.rowcount
|
||||||
logger.debug("Found {0} SQL LDAP user".format(row_count))
|
logger.debug("Found {0} SQL LDAP user".format(row_count))
|
||||||
sqlLDAPuser = cursor.fetchall()
|
|
||||||
cnx.close()
|
cnx.close()
|
||||||
if row_count == 1:
|
if row_count == 1:
|
||||||
# User is in the sql table
|
# User is in the sql table
|
||||||
|
|||||||
Reference in New Issue
Block a user