From 5e1d62caf36c9726f637f5bc394700ca1856f8e2 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 15 Sep 2020 21:01:07 +0000 Subject: [PATCH] Add more logging --- ldapserver/ldap_functions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ldapserver/ldap_functions.py b/ldapserver/ldap_functions.py index 91dd0c1..9de2772 100644 --- a/ldapserver/ldap_functions.py +++ b/ldapserver/ldap_functions.py @@ -194,6 +194,7 @@ def add_to_group(groupname, username): ldap_conn.modify_s(group_dn, mod_acct) return True else: + logger.info('Already a member, skipping') return False finally: @@ -214,6 +215,7 @@ def remove_from_group(groupname, username): ldap_conn.modify_s(group_dn, mod_acct) return True else: + logger.info('Not a member, skipping') return False finally: @@ -243,6 +245,7 @@ def is_member(groupname, username): ''' ldap_conn = init_ldap() try: + logger.info('Checking group membership...') ldap_conn.simple_bind_s(secrets.LDAP_USERNAME, secrets.LDAP_PASSWORD) group_dn = find_group(groupname) user_dn = find_user(username).encode() @@ -308,6 +311,6 @@ if __name__ == '__main__': #print(list_group("newgroup")) #print(dump_users()) - users = list_group('Laser Users') - import json - print(json.dumps(users, indent=4)) + #users = list_group('Laser Users') + #import json + #print(json.dumps(users, indent=4))