diff --git a/seafile-ldap.py b/seafile-ldap.py index 22c600f..b15f275 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -166,12 +166,12 @@ for ldapUser in ldapUsers: logger.debug("Checking if LDAP user {0} is in SQl Table".format(ldapUser.mail)) cnx = mysql.connector.connect(**dbconfig) 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)) cursor.execute(query) + sqlLDAPuser = cursor.fetchall() row_count = cursor.rowcount logger.debug("Found {0} SQL LDAP user".format(row_count)) - sqlLDAPuser = cursor.fetchall() cnx.close() if row_count == 1: # User is in the sql table