#29212: Redirect loop with @permission_required and redirect_authenticated_user
-----------------------------------------+------------------------
               Reporter:  Nick Pope      |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  2.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 The `redirect_authenticated_user` option was added by ticket #12233.
 When combined with `@permission_required` and the user does not have the
 specified permission(s), a redirect loop can occur.

 We should document (and add tests) for this behaviour and recommend the
 following pattern to avoid the issue:

 {{{#!python
 @login_required
 @permission_required('permission', raise_exception=True)
 def view(request):
     # ...
 }}}

 Documentation to be updated:

 -
 
https://docs.djangoproject.com/en/2.0/topics/auth/default/#django.contrib.auth.views.LoginView
 - https://docs.djangoproject.com/en/2.0/topics/auth/default/#the-
 permission-required-decorator

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29212>
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/050.760b551e3be8c418306b76260d565bfb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to