Skip to content

"Merge" should also check user account (and use entity with an account as the primary, remaining entity) #3619

@sleidig

Description

@sleidig

Describe the bug
When merging two entities using the bulk action, it can happen that one of the entities has a Keycloak user account associated. It then depends on luck that the entity ID linked in the user account is also the one that remains in the database.

Instead, we should:

  • check user accounts for both merging entities
  • display them in the comparison screen
  • by default, select that entity as the primary (whose _id remains in the DB), which has an account (if only one of the two has an account)
  • warn the user that an account will be orphaned (continue to exist but not have a valid entity linked to it), when the merge is confirmed and an account is linked to the entity that gets deleted by the merge (e.g. because both entities had an account)

Scenarios:

  1. no user accounts linked
    • no account merge UI visible
  2. one entity has account linked
    • show account merge UI to make this explicit
    • maybe auto-select the entity with the account to be the primary (not to be deleted), so that the account doesn't have to be updated
    • ❓ allow to delete the user account during merge? --> not important now
  3. both entities have account linked
    • show account merge UI
    • ❓ show a confirmation dialog before actually changing the accounts?
    • update account of the primary (not deleted) record upon save
    • delete the account of the secondary (deleted after merge)
  4. entity type may have user accounts (enableUserAccounts: true) but user has no account_manager permissions
    • show a warning in merge UI about permissions and possible accounts that might get orphaned
    • show confirmation before applying merge
  5. entity type may have user accounts (enableUserAccounts: true) and API is not accessible (offline / errors / ...)
    • show warning in merge UI
    • show confirmation before applying merge

Metadata

Metadata

Labels

Status: Complex Issueadvanced, particularly challenging topic that requires extensive knowledge of the code basereleased on @mastermanaged by CI (semantic-release)

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions