-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Composed permissions should be lazily evaluated #6463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
113922b
to
37688e5
Compare
@tomchristie: Tests use |
37688e5
to
32b44d9
Compare
Seems p. reasonable to me yup. Happy with it when you are. |
Ta! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this looks good. I'll just wait for CI. Thanks @FMCorz! Welcome aboard. 🎉
Thanks everyone, glad to being able to contribute! |
32b44d9
to
7c742dc
Compare
Also adds a small nice feature which is handy now when coding authorization: encode/django-rest-framework#6463 While here update the other requirements to latest.
When composing permissions, all permissions are evaluated even when the outcome is already set. This can lead to errors when the order of the permission was logically set.
For example with
IsReadonly | IsAssumingNotReadonly
, ifIsReadonly
respondsTrue
forGET
requests, logicallyIsAssumingNotReadonly
can assume that the method is notGET
. Presently, this is not the case asIsAssumingNotReadonly
is being evaluated.The patch suggests switching to lazy
or
andand
instead of the bitwise operators.(Initial report)