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()