Update seafile-ldap.py

This commit is contained in:
2021-11-02 13:09:33 -04:00
parent 9a29da1abd
commit 31863fcd5a

View File

@@ -166,9 +166,9 @@ for ldapUser in ldapUsers:
logger.debug("Checking if LDAP user is in SQl Table") logger.debug("Checking if LDAP user is in SQl Table")
cnx = mysql.connector.connect(**dbconfig) cnx = mysql.connector.connect(**dbconfig)
cursor = cnx.cursor() cursor = cnx.cursor()
query = ("SELECT * FROM LDAPUsers WHERE email = \"{0}\"".format(ldapUser.mail)) query = ("SELECT * FROM LDAPUsers WHERE email = %s")
logger.debug("Query: {0}".format(query)) cursor.execute(query, (ldapUser.mail,))
cursor.execute(query) logger.debug("Cursor: {0}".format(cursor))
row_count = cursor.rowcount row_count = cursor.rowcount
logger.debug("Found {0} SQL LDAP users".format(cursor.rowcount)) logger.debug("Found {0} SQL LDAP users".format(cursor.rowcount))
sqlLDAPuser = cursor.fetchall() sqlLDAPuser = cursor.fetchall()