← Back to Awards Plugin

5.2.13 RecommendationPolicy Reference

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

RecommendationPolicy is the central entity-level authorization policy for recommendations. It combines configured RBAC rules with workflow-aware visibility and state locks.

Important custom behavior

The policy consults workflow approvals/runs and RecommendationWorkflowUiService; callers must load enough recommendation context for the relevant decision. Do not duplicate its workflow visibility tests in controllers or templates.

Usage

Authorize the specific domain action, not a nearby CRUD action. For example, an identity able to view a recommendation is not automatically allowed to view private notes or decide an approval. Pair entity authorization with RecommendationsTablePolicy for every collection/grid/export query.

Testing

Cover normal RBAC allow/deny, current and prior approvers, pending-work index access, bestowal locks, dynamic level permissions, feedback, hidden/private content, grouping, and tenant isolation. Include query-count/regression coverage when changing request-local policy caches.