fix: the group and profile new directory users get cannot be deleted - #889
Merged
Merged
Conversation
`ldapDefaultGroup`, `ssoDefaultGroup`, `ldapDefaultProfile` and `ssoDefaultProfile` are plain ints in config.xml. Nothing points at UserGroup or UserProfile from there, so no foreign key refuses deleting the row they name — and the RESTRICT on User.userGroupId / User.userProfileId only catches one somebody currently holds, which is precisely not the case for a group or profile being tidied up because its members have moved on. So the delete succeeded cleanly, and every auto-provisioned login afterwards died: with no row to point at, `User::createOnLogin()` violates the NOT NULL foreign key, which `LoginAuthHandler` catches and reports as "Internal error, check the event log". Directory sign-in stops working for everyone who does not already have a local account, and nothing connects that to a group somebody deleted last week. Both deletes refuse it now, naming which setting holds it. The batch deletes are guarded too, because they go to the repository directly rather than through delete() — the foreign keys still stand behind them whichever door is used, but nothing in the database knows about a setting in config.xml. Checked by making the comparison always false: all four new tests fail. Unrelated, and recorded rather than claimed fixed: one full unit run during this change failed on AccountTest::testCreateCannotChangePermissions, which then passed in isolation and in three consecutive full runs. I could not reproduce it — it is not the id-zero trap (forcing the id to 0 passes) and the harness seeds an all-false ProfileData, so it is not the profile either. Noting it so the next person who sees it does not start from scratch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ldapDefaultGroup,ssoDefaultGroup,ldapDefaultProfileandssoDefaultProfileareplain ints in config.xml. Nothing points at UserGroup or UserProfile from there, so no
foreign key refuses deleting the row they name — and the RESTRICT on User.userGroupId /
User.userProfileId only catches one somebody currently holds, which is precisely not the
case for a group or profile being tidied up because its members have moved on.
So the delete succeeded cleanly, and every auto-provisioned login afterwards died: with no
row to point at,
User::createOnLogin()violates the NOT NULL foreign key, whichLoginAuthHandlercatches and reports as "Internal error, check the event log". Directorysign-in stops working for everyone who does not already have a local account, and nothing
connects that to a group somebody deleted last week.
Both deletes refuse it now, naming which setting holds it.
The batch deletes are guarded too, because they go to the repository directly rather than
through delete() — the foreign keys still stand behind them whichever door is used, but
nothing in the database knows about a setting in config.xml.
Checked by making the comparison always false: all four new tests fail.
Unrelated, and recorded rather than claimed fixed: one full unit run during this change
failed on AccountTest::testCreateCannotChangePermissions, which then passed in isolation
and in three consecutive full runs. I could not reproduce it — it is not the id-zero trap
(forcing the id to 0 passes) and the harness seeds an all-false ProfileData, so it is not
the profile either. Noting it so the next person who sees it does not start from scratch.