Feature #21684

Add a task for checking integrity of usergroup membership

Added by Kavita Gaikwad 4 months ago.

Assigned To:Swapnil Abnave
Target version:Foreman - Team Anurag backlog
Difficulty: Bugzilla link:1505412
Found in release: Pull request:
Story points-
Velocity based estimate-


Description of problem:

The usergroup membership tables (class UsergroupMember) in the foreman use polymorphic associations (either to User or Usergroup). Therefore it can't use foreign keys constraints and db integrity is ensured only by active record code and transactions.

We've experienced an issues with deleting users in past, that caused db integrity to be broken. Namely there were UsergroupMember records pointing to users that no longer existed. It's not 100% clear how that happened. It could be caused by issues with upgrade or by past bugs.

Foreman maintain should provide a check for testing whether all UsergroupMamber records point to an existant users/groups and delete those that are broken.

Adding such check also for other polymorphic relations should be considered too.

Also available in: Atom PDF