diff --git a/seafile-ldap.py b/seafile-ldap.py index 56817d7..11f642c 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -190,7 +190,7 @@ for ldapUser in ldapUsers: logger.error("There was an error setting user {0} to active in Seafile".format(ldapUser.mail)) # user is not in the SQL table else: - logger.debug("LDAP User {0} is NOT in the SQL Table".format(ldapUser.mail)) + logger.info("LDAP User {0} is NOT in the SQL Table".format(ldapUser.mail)) # add user to ldap table cnx = mysql.connector.connect(**dbconfig) cursor = cnx.cursor() @@ -200,7 +200,14 @@ for ldapUser in ldapUsers: cnx.commit() row_count = cursor.rowcount if row_count == 1: - logger.debug("LDAP user {0} was added to the SQL Table".format(ldapUser.mail)) + logger.info("LDAP user {0} was added to the SQL Table".format(ldapUser.mail)) + # need to update the name correctly as it only shows the first part of the email address as the name + # call the api to enable the user in seafile + updateSeafileUserName = request('admin/users/{0}/'.format(ldapUser.mail), seafileURL, seafileToken, "PUT", {"name": "{0} {1}".format(ldapUser.givenName, ldapUser.sn)})['response'] + #if updateSeafileUserName['is_active']: + # logger.info("User {0} was set to active in Seafile".format(ldapUser.mail)) + #else: + # logger.error("There was an error setting user {0} to active in Seafile".format(ldapUser.mail)) else: logger.error("Failed to add LDAP user {0} to the SQL Table".format(ldapUser.mail)) cnx.close()