From dbbe7a8c35083bbcd63f8309b584c8dca8059fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Mon, 28 Mar 2022 22:20:25 +0000 Subject: [PATCH] syntax error --- api/kiwi_vpn_api/routers/admin.py | 2 +- api/kiwi_vpn_api/routers/user.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/api/kiwi_vpn_api/routers/admin.py b/api/kiwi_vpn_api/routers/admin.py index 14eeacf..758b100 100644 --- a/api/kiwi_vpn_api/routers/admin.py +++ b/api/kiwi_vpn_api/routers/admin.py @@ -63,7 +63,7 @@ async def create_initial_admin( # create an administrative user new_user = User.create(**admin_user.dict()) - new_user.set_capabilities((UserCapabilityType.admin)) + new_user.set_capabilities([UserCapabilityType.admin]) new_user.update() diff --git a/api/kiwi_vpn_api/routers/user.py b/api/kiwi_vpn_api/routers/user.py index ad69d26..1db468c 100644 --- a/api/kiwi_vpn_api/routers/user.py +++ b/api/kiwi_vpn_api/routers/user.py @@ -88,7 +88,7 @@ async def add_user( # actually create the new user new_user = User.create(**user.dict()) - new_user.set_capabilities((UserCapabilityType.login)) + new_user.set_capabilities([UserCapabilityType.login]) # fail if creation was unsuccessful if new_user is None: @@ -149,9 +149,7 @@ async def extend_capabilities( # get and change the user user = User.get(user_name) - user.set_capabilities( - user.get_capabilities() | set(capabilities) - ) + user.set_capabilities(user.get_capabilities() | set(capabilities)) user.update() @@ -177,8 +175,6 @@ async def remove_capabilities( # get and change the user user = User.get(user_name) - user.set_capabilities( - user.get_capabilities() - set(capabilities) - ) + user.set_capabilities(user.get_capabilities() - set(capabilities)) user.update()