added comments and logger info
This commit is contained in:
@@ -173,13 +173,21 @@ logger.debug("Finished SQL query for LDAPUsers")
|
||||
# if they are not in the sql table, insert a new row to add them
|
||||
# if they are disabled in the sql table, enable them
|
||||
for ldapUser in ldapUsers:
|
||||
# loop through the sql ldap users
|
||||
for sqlUser in sqlLDAPusers:
|
||||
# look to make sure the ldap user is in the table
|
||||
if ldapUser.mail in sqlUser:
|
||||
# are they active
|
||||
is_active = bool(sqlUser[4])
|
||||
# log the results
|
||||
logger.debug("LDAP User {0} is already in the SQL Table, Is Active: {1}".format(ldapUser.mail, is_active))
|
||||
# if user is not active, they should be
|
||||
if not is_active:
|
||||
logger.info("User {0} is NOT active in Seafile".format(ldapUser.mail))
|
||||
# call the api to enable the user in seafile
|
||||
enableSeafileUser = request('admin/users/{0}/'.format(ldapUser.mail), seafileURL, seafileToken, "PUT", {"is_active": "true"})['response']
|
||||
print(enableSeafileUser)
|
||||
if enableSeafileUser['is_active']:
|
||||
logger.info("User {0} was set to active in Seafile".format(ldapUser.mail))
|
||||
#else:
|
||||
# add user to ldap table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user