thomasw / djproxy

djproxy is a class-based generic view reverse HTTP proxy for Django.
MIT License
42 stars 15 forks source link

request.user is anonymous user #33

Closed nimaansary closed 4 years ago

nimaansary commented 4 years ago

i want to check user permissions and then give him access to proxy. but when i want to check request.user and its permissions, it give me Anonymous user however it is not anonymous!!!

    def process_request(self, proxy, request, **kwargs):
        if request.method != 'OPTIONS':
            _u = User.objects.get(username=request.user)
            if not _u.has_perm('dummy.cm'):
                return HttpResponse({"status": -1, "msg": "you don't have permission to be here"}, content_type='application/json', status=HTTP_403_FORBIDDEN)
            else:
                return response
        else:
            return response