Skip to content

Permissions: Add ~ operator to permissions composition - #6361

Merged
carltongibson merged 1 commit into
encode:masterfrom
adrienbrunet:permissions_not
Feb 25, 2019
Merged

carltongibson merged 1 commit into
encode:masterfrom
adrienbrunet:permissions_not

Conversation

@adrienbrunet

Copy link
Copy Markdown
Contributor

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.

@xordoquy xordoquy added this to the 3.9.1 Release milestone Dec 19, 2018
@xordoquy

Copy link
Copy Markdown
Contributor

Looks good at first, will have a closer look at it.

@carltongibson carltongibson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. Thanks!

(Ref docs: PRs working those up a bit always welcome. 🙂)

@carltongibson
carltongibson merged commit 2daf6f1 into encode:master Feb 25, 2019
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants