-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Modify AND
and OR
permission operands to have the ability to use custom messages
#6502
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
bcffbac
to
1d77243
Compare
@ozandogrultan Many thanks for your comments. I have updated this PR. |
@samitnuk wrote
I think for this case, we should add the class MyCustomPermission(permissions.BasePermission):
message = _("you are not active")
inverted_message = _("you are active") and use it for class NOT:
def __init__(self, op1):
self.op1 = op1
self.message = getattr(self.op1, 'inverted_message', None) but this is incorrect for double negative. |
Hi, @iproha94. Thank you for your review. I will check your comments and make updates asap. |
ab99187
to
12e0009
Compare
@ozandogrultan, @auvipy, @iproha94 please review the updated PR. Many thanks. |
Is this being merged? |
12e0009
to
09979d6
Compare
Any plans to to get this merged?? |
I am running into this issue currently. Is this in the roadmap to get merged? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Same issue here. |
let see how it works on current CI |
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.
I think this enhancement also needs documentation updates
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
refs #6427
AND
- If failed permission has a message, it will be returned.OR
- If both permissions will be failed:a) if both permissions have messages - will be returned one message combined from two messages;
b) if only one permission (from both failed) has a message - this message will be returned (I suppose this is better then return the default one).
NOT
- If failed permission has amessage_inverted
attribute, it will be returned. (@iproha94 thanks for this suggestion).