scripts/moduser

21 lines
425 B
Python
Executable file

#!/usr/bin/python
from sys import argv
from subprocess import run
def moduser(username):
"""Modify an existing user"""
if username == 'Manager':
bind_user = 'cn=Manager,dc=exozy,dc=me'
else:
bind_user = 'uid=' + username + ',ou=People,dc=exozy,dc=me'
# Modify user with ldapvi
run(['ldapvi', '--user', bind_user])
# Running as script
if __name__ == "__main__":
moduser(argv[1])