Rules-based permissions for Django REST Framework, enabling complex permission logic through a declarative, rule-based approach. Current version 0.1.10, released Jun 15, 2020. Low release cadence, maintained as of latest commit Aug 2022.
pip install dry-rest-permissionsVerified import paths — ran on the pinned version, not inferred.
Apply DRYPermissions to a viewset. Define permissions via 'read_permissions' and 'write_permissions' on model's DRYMeta class.
Define a DRYMeta inner class on your model with read_permissions and write_permissions callable.
Use signature: def permission_function(user, obj=None): ... and DRYPermissions will pass request.user.
Use DRYPermissions and implement global check in write_permissions/read_permissions with obj=None.