forked from ScoDoc/DocScoDoc
delete-role
This commit is contained in:
parent
d740244d25
commit
4b6f91b304
10
scodoc.py
10
scodoc.py
@ -248,6 +248,16 @@ def edit_role(rolename, addpermissionname=None, removepermissionname=None): # e
|
||||
db.session.add(role)
|
||||
db.session.commit()
|
||||
|
||||
@app.cli.command()
|
||||
@click.argument("rolename")
|
||||
def delete_role(rolename):
|
||||
"""Delete a role"""
|
||||
role = Role.query.filter_by(name=rolename).first()
|
||||
if role is None:
|
||||
sys.stderr.write(f"delete_role: role {rolename} does not exists\n")
|
||||
return 1
|
||||
db.session.delete(role)
|
||||
db.session.commit()
|
||||
|
||||
@app.cli.command()
|
||||
@click.argument("username")
|
||||
|
Loading…
Reference in New Issue
Block a user