Delegate django rest framework object permissions to an object pointed by foreign key/m2m
Sample: set up permissions so that anyone having django/django guardian permissions on Invoice will have the same set of permissions on its address:
class Address(models.Model):
... address fields
class Invoice(models.Model):
address = models.OneToOneField(Address, related_name='invoice')
... invoice fields
perms = RestPermissions()
@perms.apply(permissions=DelegatedPermissions(perms, "invoice")
class AddressViewSet(ModelViewSet):
queryset = Address.objects.all()
serializer = AddressSerializer
...
@perms.apply() # implicitely adds django model permissions and guardian permissions
class InvoiceViewSet(ModelViewSet):
queryset = Invoice.objects.all()
serializer = InvoiceSerializer
...
See docs and API at github.
Metadata
Release files for django-rest-delegated-permissions 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-rest-delegated-permissions-1.4.0.tar.gz | 6.5 kB | Without provenance | Details for django-rest-delegated-permissions-1.4.0.tar.gz |
Release files / django-rest-delegated-permissions-1.4.0.tar.gz
| Download URL | django-rest-delegated-permissions-1.4.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e96ff4416401d15c91a794171fdc147239f5c15ba5e2c5383aee00096d4b9c39
|
|
BLAKE2b-256 checksum How to use checksums |
8faad6927086804306ac7bc4da43e9bb07ddc3e36e1dc78d1d1329e2f2ff8b0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.3
|
Security for django-rest-delegated-permissions 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.