feat(mgr-api): document-level ACL для category products - #473
Open
Ibochkarev wants to merge 3 commits into
Open
Conversation
Add checkPolicy view/save/publish/delete on CategoryProductsController endpoints to complement global msproduct_* permissions (#378).
Ibochkarev
force-pushed
the
feat/issue-445-category-document-acl
branch
from
July 29, 2026 11:35
94b0f94 to
ae8c4bd
Compare
CategoryProductsControllerScopeTest failed after #445 because sort requires a category with checkPolicy(view) and products with save.
Ibochkarev
added a commit
that referenced
this pull request
Jul 29, 2026
Apply CategoryProductDocumentPolicy save check on the updateProductData inline-edit path (#473 pattern) and resolve scope via CategoryProductScopePolicy through findInCategory() instead of the separate isProductInCategoryScope() bool-only getObject round-trip. - Import CategoryProductDocumentPolicy (cherry-picked from #473) - Refactor CategoryProductScopeService::findInCategory nested branch to delegate to CategoryProductScopePolicy::isParentInScope - Replace isProductInCategoryScope() call in updateProductData with scopeService()->findInCategory() (single lookup, yields product for ACL) - Add 403 save-policy guard + logDocumentPolicyDenied helper - Tests: CategoryProductDocumentPolicyTest + ACL denial / out-of-scope cases in CategoryProductsControllerScopeTest; stubs support per-product policies and lexicon
Over-fetch visible rows for paginated grids, count ACL-visible total, batch-load products for view filter, and return 403 when bulk actions are denied solely by document policy.
Ibochkarev
added a commit
that referenced
this pull request
Jul 29, 2026
Apply CategoryProductDocumentPolicy save check on the updateProductData inline-edit path (#473 pattern) and resolve scope via CategoryProductScopePolicy through findInCategory() instead of the separate isProductInCategoryScope() bool-only getObject round-trip. - Import CategoryProductDocumentPolicy (cherry-picked from #473) - Refactor CategoryProductScopeService::findInCategory nested branch to delegate to CategoryProductScopePolicy::isParentInScope - Replace isProductInCategoryScope() call in updateProductData with scopeService()->findInCategory() (single lookup, yields product for ACL) - Add 403 save-policy guard + logDocumentPolicyDenied helper - Tests: CategoryProductDocumentPolicyTest + ACL denial / out-of-scope cases in CategoryProductsControllerScopeTest; stubs support per-product policies and lexicon
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.
Описание
Добавлен resource-level ACL (
checkPolicy) для Manager API «Товары категории»: поверх глобальныхview_document/msproduct_*(#378) проверяются права MODX на документ категории и каждый товар.getList,getFilters):viewна категорию; в списке —viewна товар, приnested=1такжеviewна родительскую категорию товара.sort,multiple,publish):save/publish/delete(+ составныеsave+unpublish,save+undeleteкак в legacy processors).CategoryProductActionPermissions.Closes #445
Тип изменений
Связанные Issues
Closes #445
Дополнительно: дополняет #378; не заменяет category scope IDOR из #418 / PR #443.
Как это было протестировано?
php -l— 378 PHP-файлов, exit 0Smoke:
CategoryProductDocumentPolicyTest.php,CategoryProductActionPermissionsTest.phpи остальные 19 тестов — exit 0Ручное тестирование
Автоматические тесты (
composer ci:php)Тестирование на разных версиях PHP/MODX
Конфигурация тестирования:
feat/issue-445-category-document-aclЧеклист
ProductDataServicenpm run lint:ciдля Vue) — Vue не затронутДополнительные заметки
getList:totalиз SQL может быть выше числа видимых строк после document ACL filter на странице (pagination edge case); данные недоступных товаров не отдаются.