added logic to add ldap user to sql table
This commit is contained in:
@@ -192,7 +192,18 @@ for ldapUser in ldapUsers:
|
||||
else:
|
||||
logger.debug("LDAP User {0} is NOT in the SQL Table".format(ldapUser.mail))
|
||||
# add user to ldap table
|
||||
insert = ''
|
||||
cnx = mysql.connector.connect(**dbconfig)
|
||||
cursor = cnx.cursor()
|
||||
query = "INSERT INTO LDAPUsers (email, is_staff, is_active) VALUES ({0}, {1}, {2})".format(ldapUser.mail, 0, 1)
|
||||
logger.debug("Query: {0}".format(query))
|
||||
cursor.execute(query)
|
||||
cnx.commit()
|
||||
row_count = cursor.rowcount
|
||||
if row_count == 1:
|
||||
logger.debug("LDAP user {0} was added to the SQL Table".format(ldapUser.mail))
|
||||
else:
|
||||
logger.error("Failed to add LDAP user {0} to the SQL Table".format(ldapUser.mail))
|
||||
cnx.close()
|
||||
|
||||
|
||||
#seafileUsers = request('admin/search-user/?query=@johnhgaunt.com', seafileURL, seafileToken)['response']['user_list']
|
||||
|
||||
Reference in New Issue
Block a user