From 21411694e808021840a4f56badba67904416d465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Sun, 20 Mar 2022 00:12:37 +0000 Subject: [PATCH] give admin user "admin" capability --- api/kiwi_vpn_api/db/schemas.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/kiwi_vpn_api/db/schemas.py b/api/kiwi_vpn_api/db/schemas.py index 0e52185..709bb01 100644 --- a/api/kiwi_vpn_api/db/schemas.py +++ b/api/kiwi_vpn_api/db/schemas.py @@ -128,12 +128,16 @@ class User(UserBase): self, db: Session, capabilities: list[UserCapability], - ) -> bool: + ) -> None: for capability in capabilities: - # TODO - pass + if capability not in self.capabilities: + cap = models.UserCapability( + user_name=self.name, + capability=capability.value, + ) + db.add(cap) - return True + db.commit() class DistinguishedNameBase(BaseModel):