dfunckt / django-rules

Awesome Django authorization, without the database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass Payload into Predicate for POST

sang356 opened this issue · comments

Is there a way to pass POST method's payload into predicate so that I can determine the permission of the object, which would be in the payload? Currently the form of predicate(user) is applied to POST method so I have no way of grabbing an object relevant to the model. It would be nice if I can pass the payload into the predicate and have a logic in there to determine the permission.

Hey @slee356, is there some parent/child relationship? Is "object" the parent?

It's currently not possible to get hold of the request within permission predicates because Django isn't providing one. If there's a parent/child relationship though you should be able to enforce permissions at the parent level.

Appreciate the response! @dfunckt