delete role when ownership delete#2154
delete role when ownership delete#2154grubolsch wants to merge 1 commit intoIII-6975/fix-replay-role-addedfrom
Conversation
| $this->{$handleMethod}($event, $domainMessage); | ||
| } | ||
|
|
||
| public function deleteRoleIfNoOwnerships(?Uuid $roleId): void |
There was a problem hiding this comment.
Why is this a public method?
| { | ||
| // Search for any ownerships (approved state only) that are linked to this role | ||
| // We look for approved ownerships since only approved ownerships have members in the role | ||
| $ownerships = $this->ownershipSearchRepository->search( |
There was a problem hiding this comment.
I'm not sure this will work because you only search for 100 ownerships. It also seems overkill to iterate over all these ownerships.
Should we not just get the remaining users on the role after the RemoveUser? If the last user on a role is removed the role can also be deleted? It doesn't matter that ownerships still point to this deleted role because it gets a soft delete.
There was a problem hiding this comment.
Another approach would be to add the roleId as a SearchParameter so you can verify if no other Ownership references this Role
|
I think we can close this since we have some nice tickets https://jira.publiq.be/browse/III-7029 and https://jira.publiq.be/browse/III-7030 |
Added
Changed
Removed
Fixed
Ticket: https://jira.uitdatabank.be/browse/...