diff --git a/seafile-ldap.py b/seafile-ldap.py index 2ef62b8..8110d8a 100644 --- a/seafile-ldap.py +++ b/seafile-ldap.py @@ -229,31 +229,8 @@ for sqlLDAPuser in sqlLDAPusers: logger.info("User {0} was set to disabled in Seafile".format(sqlLDAPuser[1])) else: logger.error("There was an error setting user {0} to disabled in Seafile".format(sqlLDAPuser[1])) - - #if [item for item in ldapUsers if sqlLDAPuser[1] in item]: - #logger.debug("Found {0} in sql table".format(sqlLDAPuser[1])) - -#seafileUsers = request('admin/search-user/?query=@johnhgaunt.com', seafileURL, seafileToken)['response']['user_list'] -#for user in seafileUsers: -# logger.debug("User: {0} - Email: {1} - isActive: {2}".format(user['name'], user['email'], user['is_active'])) -#print(ldap.entries[0].distinguishedName) exit() -#Create a connection object, and bind with the given DN and password. -try: - conn = Connection(server, bindAccount, bindPassword, auto_bind=True) - print('LDAP Bind Successful.') - # Perform a search for a pre-defined criteria. - # Mention the search filter / filter type and attributes. - conn.search('CN=Users,dc=home,dc=johnhgaunt,dc=com', '(&(mail=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(memberOf=CN=Seafile,CN=Users,DC=home,DC=johnhgaunt,DC=com))') - # Print the resulting entries. - for entry in conn.entries: - print(entry) -except core.exceptions.LDAPBindError as e: - #If the LDAP bind failed for reasons such as authentication failure. - print('LDAP Bind Failed: ', e) - -# sync ad users with seafile, if disabled or deleted ad user, disable in seafile # get ad groups and import them into seafile