1
0
forked from ScoDoc/ScoDoc

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("username")
@click.argument("role") @click.argument("role")
@click.argument("dept") @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" "Create a new user"
r = Role.get_named_role(role) r = Role.get_named_role(role)
if not r: if not r:
@ -131,7 +133,7 @@ def user_create(username, role, dept): # user-create
return 2 return 2
if dept == "@all": if dept == "@all":
dept = None 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) u.add_role(r, dept)
db.session.add(u) db.session.add(u)
db.session.commit() db.session.commit()