check if user can do

This commit is contained in:
Jörn-Michael Miehe 2022-03-28 01:28:49 +00:00
parent 22e1ef7bf4
commit d41cd9b15b

View file

@ -109,6 +109,9 @@ class User(UserBase, table=True):
db.delete(self) db.delete(self)
db.commit() db.commit()
def can(self, capability: Capability) -> bool:
return capability in self.get_capabilities()
def get_capabilities(self) -> set[Capability]: def get_capabilities(self) -> set[Capability]:
return set( return set(
capability._ capability._