← Back to Awards Plugin

5.2.6 AwardsTablePolicy Reference

Source: app/plugins/Awards/src/Policy/AwardsTablePolicy.php

AwardsTablePolicy extends BasePolicy and customizes collection scoping. scopeIndex() obtains authorized branch IDs, discovers approval authority from dynamic RecommendationPolicy::canApproveLevel* policy names, applies AwardsTable::addBranchScopeQuery(), and narrows by associated level when level authority is present. scopeGridData() delegates to the same scope.

Controllers must authorize the collection action and pass the scoped query to pagination/grid/export code. Do not rebuild an unscoped Awards query after authorization. When changing level names, branch scope, or dynamic approval permissions, add table-policy tests because those values participate in query construction.

The scope operates only inside the active tenant database; tenant isolation does not replace this within-tenant authorization filter.