#25142: Refactor access mixins to allow customisation
--------------------------------------+------------------------------------
Reporter: dfunckt | Owner: dfunckt
Type: Cleanup/optimization | Status: assigned
Component: contrib.auth | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Description changed by dfunckt:
Old description:
> Extending from PermissionRequiredMixin to implement a mixin for checking
> for *object* permissions means that you can't call super in .dispatch
> because PermissionRequiredMixin will do another check for model-level
> permissions.
>
> I propose to delegate the check for permissions in
> PermissionRequiredMixin.dispatch to an instance method. This way, we are
> able to provide a hook for code to check for object permissions without
> having to re-implement the whole class.
>
> PR coming shortly.
New description:
Extending from PermissionRequiredMixin to implement a mixin for checking
for *object* permissions means that you can't call super in .dispatch
because PermissionRequiredMixin will do another check for model-level
permissions.
I propose to delegate the check for permissions in
PermissionRequiredMixin.dispatch to an instance method. This way, we are
able to provide a hook for code to check for object permissions without
having to re-implement the whole class.
PR coming shortly.
----
I have went ahead and generalised the ticket and patch to refactor all
access mixins.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25142#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.4ae27d5003935cb9a97fec9d25ebb086%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.