-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Hi,
First of all, thanks for making this library. I'm on my first FastAPI project right now and we're really liking the library so far.
However, we do run into a little problem when using dynamically generated ACL's. Our app is connected via Tortoise ORM to a PostgreSQL-database, from which we are generating the ACL's in the models. We are required to approach the database async, so we need to make the ACL-function in the model async as well. Like this:
async def __acl__(self) -> List:
acl = []
# Do stuff with the database here, and append them as rules in the ACL
# Example:
async for attendee in self.parent_activity.get_attendees():
acl.append((Allow, f"user:{attendee.user.id}", "view"))
return acl
However, when checking the object this ACL is attached to via the Permission-function, we are greeted with the following error:
RuntimeWarning: coroutine 'Activity.__acl__' was never awaited
(Activity is the model name)
Could you maybe implement an await for the ACL's? Like I said, this is my first project with FastAPI so maybe I'm using it all wrong, but we are stuck with this now. Thanks in advance!