fix(security): Delete user — modAccess error - #86
Open
Ibochkarev wants to merge 3 commits into
Open
Conversation
Remove the invalid Acls composite on modPrincipal (modAccess has no table). Clear concrete ACL rows via getDescendants + removeCollection before parent::remove(), using class_key for user derivatives and ignoring principal_targets (load-time setting, not cleanup registry). Fixes modxcms#11276
User group ACL rows store MODX\Revolution\modUserGroup; late static binding on driver instances returned mysql\modUserGroup and skipped cleanup.
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.
Что сделано
Удаление пользователя раньше заставляло xPDO каскадить через отношение
AclsнаmodPrincipal, указывающее на абстрактныйmodAccess(без таблицы). Вы получали спам в логе видаCould not get table class or name for class: modAccess, хотя пользователь исчезал.Этот PR убирает composite из схемы, затем удаляет конкретные строки ACL (
access_context,access_menus, … плюс package ACL-классы изgetDescendants(modAccess)) черезremoveCollectionпередparent::remove(). Очистка используетclass_keyпользователя, поэтому производные тоже матчат.principal_targetsне трогается: он только контролирует, какие ACL-классы грузят атрибуты, а не какие таблицы мы чистим.modUserGroup::remove()делит тот же хелпер. Регрессионные тесты покрывают пользователя, группу и строки ACL вне суженногоprincipal_targets.Зачем нужно
Bulk delete в Security → Users выглядел нормально в UI, но лог ошибок заполнялся, а некоторые ACL-таблицы могли остаться неконсистентными. #11276 открыт с 2014 за это.
Как проверить
modAccess.mod_access_*таблиц.Связанные
Refs modxcms#11276
Оригинал: modxcms#16835