forked from crudo/macao-pos
Implement 'user set' command in cli.py.
This commit is contained in:
parent
96ccea0899
commit
22476bfb7b
20
cli.py
20
cli.py
|
@ -63,6 +63,26 @@ def user_list():
|
||||||
print("No users found.")
|
print("No users found.")
|
||||||
|
|
||||||
|
|
||||||
|
@user.command('set')
|
||||||
|
@click.option('-p', '--password')
|
||||||
|
@click.argument('user_uid', type=click.INT)
|
||||||
|
def user_set(user_uid, password):
|
||||||
|
with db.get_session() as session:
|
||||||
|
user = session.query(User).get(user_uid)
|
||||||
|
|
||||||
|
if not user:
|
||||||
|
print("No user found with id #{}.".format(user_uid))
|
||||||
|
return
|
||||||
|
|
||||||
|
if password:
|
||||||
|
user.password = password
|
||||||
|
|
||||||
|
with db.get_session() as session:
|
||||||
|
session.add(user)
|
||||||
|
|
||||||
|
print("User successfully edited.")
|
||||||
|
|
||||||
|
|
||||||
@cli.group('event')
|
@cli.group('event')
|
||||||
def event():
|
def event():
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user