-
Notifications
You must be signed in to change notification settings - Fork 148
Description
I am working on a project that uses django-rules
to apply some permissions checks using custom predicates. This particular project I am working on is using Django asynchronously via Daphne. I have found that, if I use something like:
perm_check = await sync_to_async(user.has_perm)(MyModel.get_perm("change"), my_object)
Everything works okay. However, if I use the new ahas_perm
variant (introduced in Django 5.2), like so:
perm_check = await user.ahas_perm(MyModel.get_perm("change"), my_object)
Then my custom predicates are all skipped. I suspect this has to do with there being no ahas_perm
implementation in the ObjectPermissionBackend
(here), so Django sees the backend has no implementation and it is skipped. I think it would be good to have an implementation for ahas_perm
in the backend, so that the ahas_perm
interface can be used just as easily as has_perm
.
I am open to contributing at least a simple implementation, if this was not already planned/in-work.