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.
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
[CORE-58] Cascade policy deletion #1564
[CORE-58] Cascade policy deletion #1564
Changes from 16 commits
3616bde
abdf118
511f6cf
5c2c881
4a80260
08abd65
ef2be68
fc94de3
e50536f
4455509
841c2c8
2ad6f23
a9a3083
5f1ac33
a6bcf06
8ba9c4e
8c0ad7d
f78fb5a
8b4fa1b
bf02fc0
34d18e8
7428caf
825b766
e4f2975
71b8dd5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
The resource was deleted in the line above, the database calls in
cloudSyncPolicies
won't find anything. I think you need to get the list of groups that will be changed by having the resource removed before deleting the resource then sync them afterwards.And something else I think I missed:
PostgresGroupDAO.updateGroupUpdatedDateAndVersion
needs to be called for each group updated.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.
Just to make sure I understand what you're asking, I should do something like:
Is that correct?
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.
yes but
updateGroupUpdatedDateAndVersion
should come beforecloudSyncPolicies
. The sync process keeps track of the last synchronized version and won't do anything if that version is the same as the current version. So the order of operations should be change the policy/group in the sam db, bump the version, cloud sync.And here is yet another idea (sorry if I am jerking you around): instead of your new database queries to bulk delete entries, you can list the policies that need to be updated along with which policy is being removed. For each of those pairs (policy changing, policy removed), call
removeSubjectFromPolicy
(in the same class,ResourceService
). That takes care of the database calls, syncing, everything. The code would look something likewhere
findAffectedPolicies
(or maybe there is a better name) returns aIO[List[(FullyQualifiedPolicyId, FullyQualifiedPolicyId)]]