rsinger86 / drf-access-policy

Declarative access policies/permissions modeled after AWS' IAM policies.
https://rsinger86.github.io/drf-access-policy/
MIT License
466 stars 50 forks source link

How to apply access policies to class based views #103

Open noemiefedon opened 5 months ago

noemiefedon commented 5 months ago

I would like to apply the class-based views, not to ViewSets or function-based views. For example I would like to use the access policies to Views derived from rest_framework.generics, such as RetrieveAPIView.

I managed to apply the access policy when using "action": ["*"] for the RetrieveAPIView view, but if I use "action": ["list", "retrieve", "get"] it does not work, so I don't know how to use finely-tuned access policies in this context.

Thanks in advance for your help :)

ex8 commented 3 months ago

I am also wondering this, does this library work for DRF Generic Views?

Edit: https://github.com/rsinger86/drf-access-policy/issues/37