Project

General

Profile

Feature #21684

Add a task for checking integrity of usergroup membership

Added by Kavita Gaikwad about 1 year ago. Updated 4 months ago.

Status:
New
Priority:
Normal
Category:
-
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

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