Use set comparison for updating permissions, groups, actions, and object types #1456
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue
#1455
New Behavior
user.groups
,user.permissions
,user_group.permissions
,permission.actions
, andpermission.object_types
are all serialized as lists. When compared as lists, however, any ordering changes means that theuser
,user_group
, orpermission
are updated unnecessarily.Contrast to Current Behavior
Convert these fields into sets prior to comparison during the update process.
Discussion: Benefits and Drawbacks
Unnecessary updates can be very costly for objects with large numbers of permissions, so avoiding that would be great.
The only drawback I can think of would be a negligible increase in compute, which is offset by fewer required network requests.
I don't think ordering of these fields is a feature so this would be backwards compatible.
Changes to the Documentation
No changes.
Proposed Release Note Entry
user.groups
,user.permissions
,user_group.permissions
,permission.actions
, andpermission.object_types
are now treated as unordered sets for update comparison purposes.Double Check
devel
branch.