fix(manager-api): tighten ACL on customers and category products#400
Open
Ibochkarev wants to merge 2 commits into
Open
fix(manager-api): tighten ACL on customers and category products#400Ibochkarev wants to merge 2 commits into
Ibochkarev wants to merge 2 commits into
Conversation
Replace group-level view_document with msorder_* / msproduct_* permissions aligned to legacy processors so content editors cannot mutate via mgr API.
Extract CategoryProductActionPermissions::evaluate() so controller deny paths are unit-tested without bootstrapping MODX.
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.
Описание
Мутации покупателей и товаров категории в Manager API были доступны с одним
view_document. Content editor мог удалять клиентов и публиковать товары, хотя inline product-data уже требовалmsproduct_save.Права выровнены с legacy processors: customers →
msorder_list|view|save|remove; category products →view_documentтолько на GET,msproduct_saveна sort,msproduct_deleteна bulk,msproduct_publishна publish;/multiple— route gate (AnyPermissionMiddleware) + точная проверка поmethodчерезCategoryProductActionPermissions::evaluate().Тип изменений
Связанные Issues
Closes #378
Как это было протестировано?
Конфигурация тестирования:
fix/issue-378-manager-api-permissionsКоманды (exit 0):
php -lна затронутых PHPphp tests/CategoryProductActionPermissionsTest.php— map + 403 forbidden + 400 unknown method + no escalation via wrong permissiontests/*.phpРучной сценарий issue (роль только с
view_document→ DELETE customer / publish) на стенде не гоняли.Скриншоты (если применимо)
Чеклист
Дополнительные заметки
Смена контракта: unknown
methodв POST/products/multiplemethodids)view_documentRequired permission: …Клиенты, которые ожидали 500 на мусорный
method, получат 400. Семантика корректнее; это осознанное ужесточение ответа, не silent break бизнес-логики.Permission ↔ routes (этот PR)
/customers, addresses listmsorder_list/customers/{id}msorder_viewmsorder_savemsorder_removeview_documentmsproduct_savemsproduct_deletemsproduct_publishevaluate()Notes for reviewers
grid-configи orders group — вне scope ([Bug] Manager API: customers CRUD и category publish под view_document #378)./multipleпокрыты unit-тестомevaluate()(без полного MODX bootstrap).