user-create avec nom et prenom

This commit is contained in:
Emmanuel Viennet 2021-08-08 09:50:10 +02:00
parent cc1967b315
commit 186440293d

View File

@ -119,7 +119,9 @@ def _clear_users_db():
@click.argument("username")
@click.argument("role")
@click.argument("dept")
def user_create(username, role, dept): # user-create
@click.option("-n", "--nom", "nom")
@click.option("-p", "--prenom", "prenom")
def user_create(username, role, dept, nom=None, prenom=None): # user-create
"Create a new user"
r = Role.get_named_role(role)
if not r:
@ -131,7 +133,7 @@ def user_create(username, role, dept): # user-create
return 2
if dept == "@all":
dept = None
u = User(user_name=username, dept=dept)
u = User(user_name=username, dept=dept, nom=nom, prenom=prenom)
u.add_role(r, dept)
db.session.add(u)
db.session.commit()