From 03aa7a32314ae5334277583775fccc9fb44a18e9 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 4 Apr 2021 21:46:51 +0200 Subject: [PATCH] [roles] controller: Fixed setting permissions --- flaschengeist/controller/roleController.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flaschengeist/controller/roleController.py b/flaschengeist/controller/roleController.py index 501da56..a280388 100644 --- a/flaschengeist/controller/roleController.py +++ b/flaschengeist/controller/roleController.py @@ -44,12 +44,11 @@ def update_role(role, new_name): def set_permissions(role, permissions): - role.permissions.clear() for name in permissions: p = Permission.query.filter(Permission.name.in_(permissions)).all() if not p or len(p) < len(permissions): raise BadRequest("Invalid permission name >{}<".format(name)) - role.permissions.extend(p) + role.permissions = list(p) db.session.commit()