-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Sync the is_superuser flag when the members relationship changes #8833
Sync the is_superuser flag when the members relationship changes #8833
Conversation
…ior it was only corroborating from the DB to RBAC and we need both ways
… impact the data sent within the POST so that it can impact the User model, this may not work because the POST is related only to the Roles model
Build failed.
|
'When the is_superuser flag is false but a user has the System Admin role, update the database to reflect that' | ||
if kwargs['action'] in ['post_add', 'post_remove', 'post_clear']: | ||
new_status_value = bool(kwargs['action'] == 'post_add') | ||
if hasattr(instance, 'singleton_name'): # duck typing, role.members.add() vs user.roles.add() |
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.
If someone hates me too bad for this, you could use the reverse
kwarg, but how do you know at a glance which is the reverse and which is the non-reverse?
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 was going to say something about the use of singleton_name
here, but apparently that's an actual field on the Role
model.
Build succeeded.
|
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.
we have passing testing
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.
This looks reasonable to me.
Build succeeded (gate pipeline).
|
This was giving the wrong behavior before.
work started by @rebeccahhh at
devel...rebeccahhh:devel