Fix whitespace
This commit is contained in:
parent
0b09246cc8
commit
707e89595e
|
@ -147,7 +147,7 @@ def add_to_group(groupname,username):
|
||||||
ldap_conn.simple_bind_s(secrets.LDAP_USERNAME, secrets.LDAP_PASSWORD)
|
ldap_conn.simple_bind_s(secrets.LDAP_USERNAME, secrets.LDAP_PASSWORD)
|
||||||
group_dn = find_group(groupname)
|
group_dn = find_group(groupname)
|
||||||
user_dn = find_user(username)
|
user_dn = find_user(username)
|
||||||
|
|
||||||
# -- TODO: Check to see if user is already a member, skip if not needed (Done)
|
# -- TODO: Check to see if user is already a member, skip if not needed (Done)
|
||||||
if not is_member(groupname,username):
|
if not is_member(groupname,username):
|
||||||
mod_acct = [(ldap.MOD_ADD, 'member', user_dn.encode())]
|
mod_acct = [(ldap.MOD_ADD, 'member', user_dn.encode())]
|
||||||
|
@ -179,7 +179,7 @@ def list_group(groupname):
|
||||||
ldap_conn.unbind()
|
ldap_conn.unbind()
|
||||||
|
|
||||||
def is_member(groupname,username):
|
def is_member(groupname,username):
|
||||||
'''
|
'''
|
||||||
Checks to see if a user is a member of a group
|
Checks to see if a user is a member of a group
|
||||||
'''
|
'''
|
||||||
ldap_conn = init_ldap()
|
ldap_conn = init_ldap()
|
||||||
|
@ -195,7 +195,7 @@ def is_member(groupname,username):
|
||||||
for m in members_tmp:
|
for m in members_tmp:
|
||||||
if m == user_dn:
|
if m == user_dn:
|
||||||
memflag = True
|
memflag = True
|
||||||
|
|
||||||
return memflag
|
return memflag
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -204,7 +204,7 @@ def is_member(groupname,username):
|
||||||
def abort(message):
|
def abort(message):
|
||||||
print(message)
|
print(message)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user