> Do we know of any custom user models with this unconventional behaviour?

FWIW, I have a project with the following code snippet:

---

class AuthenticatedAnonymousUser(AnonymousUser):
    def is_authenticated(self):
        return True


class AnonymousAuthenticationMiddleware(AuthenticationMiddleware):
    def process_request(self, request):
        response = super().process_request(request)
        if not response and not request.user.is_authenticated():
            if check_api_auth():
                request.user = AuthenticatedAnonymousUser()
            else:
                response = HttpResponseForbidden()
        return response

---

This is a small, internal, private project. Users can access the app though
HTML pages by logging in (traditional web app) or through a user-less API.
Many scripts use the API.

This allows views to check user.is_authenticated(). This passes for the
AuthenticatedAnonymousUser, but the user is still treated as anonymous.

While I find this convenient, I could easily solve this some other way. But
I wanted to point out that this use exists.

Cheers,
Jon

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CADhq2b4wYyGzND916rJdqYkMTAC%3DaJyzZXpOCP%3DbiWcEqMMp1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to