Permissions: Add ~ operator to permissions composition by adrienbrunet · Pull Request #6361 · encode/django-rest-framework (original) (raw)

This PR add support for ~ "NOT" operator.
Recent updates from @xordoquy add support for & "AND" and | "OR" operator with permissions. I felt ~ "NOT" was missing.

We could now do something like permission_classes = (~cond1 & cond2).

I updated only a very tiny bit of the documentation.

If we keep going further with this approach, I don't know if the mentions of "Composed Permissions" and "Rest Condition" will stay relevant. More documentation on how to compose permissions could be a good thing, it is a bit discrete right now.