Ron
Ron

Reputation: 23516

TastyPie - Override_urls ignores Authentication and Authorization

I have the following resource:

class MyUserResource(resources.MongoEngineResource):

    class Meta:
        ...
        authentication = MyKeyAuthentication()
        authorization = ApiKeyAuthorization()

    def override_urls(self):
        return [...] 

All API calls which are standard-tastypie are routed through the authentification and authorization. But all customized functions/urls (which are in my override_urls) simply ignore the auth/auth functions...

Any ideas why?

Edit:

Maybe the problem is that the dispatcher isn't called. The question remains why that is... and how I can change this behavior!

Upvotes: 7

Views: 1139

Answers (1)

Ron
Ron

Reputation: 23516

Ok, finally I found out that when customizing / overriding my urls I also override the standard behavior of calling wrap_view. This causes the not-calling of dispatch which is in charge of checking the auth-methods.

So I just put the auth-checks manually in evey of my functions (like this):

self.is_authenticated(request)
self.is_authorized(request)

Hope this helps other desperate tastypie-developers :)

Upvotes: 16

Related Questions