From d41cd9b15be674379070d2621453d8dfad6f81fc 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 01:28:49 +0000 Subject: [PATCH] check if user can do --- api/kiwi_vpn_api/db_new/user.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/kiwi_vpn_api/db_new/user.py b/api/kiwi_vpn_api/db_new/user.py index b8cd6ec..2e53964 100644 --- a/api/kiwi_vpn_api/db_new/user.py +++ b/api/kiwi_vpn_api/db_new/user.py @@ -109,6 +109,9 @@ class User(UserBase, table=True): db.delete(self) db.commit() + def can(self, capability: Capability) -> bool: + return capability in self.get_capabilities() + def get_capabilities(self) -> set[Capability]: return set( capability._