Add a report page listing the Access Policy services in the site and what permissions they affect

Created on 12 July 2025, 3 days ago

Problem/Motivation

The Access Policy API makes customized fine grained access easy to implement on any site. Modules can write policy services that grant or revoke permissions to any or all users, depending on context, such as time of day or what page they're on.

As someone who needs to audit the policies, it would be useful to have a list of the Policy services on a single page under Admin > Reports, similar to the field list report.

Proposed resolution

Add a couple functions to the AccessPolicyInterface that requires the policy to return a list of the affected permissions and a short description of what it is trying to accomplish. Add a page that collects the affected permissions and descriptions from each of the AccessPolicy services.

Remaining tasks

  • Add public function getAffectedPermissions(): array to AccessPolicyInterface
  • Add public function getPolicyDescription(): string to AccessPolicyInterface.
  • Create a Reports > Access Policies page to list the policies in the site.

The initial implementation can log a warning that no permissions list or description is available for the policy. In Drupal 12, the two functions should be required.

Alternate implementation: use annotations for the permissions list and description.

User interface changes

Addition of an Access Policy report page.

Introduced terminology

"Access Policy API." (seriously, no one knows what this is.)

API changes

  • + AccessPolicyInterface::getPermisisonList(): array
  • + AccessPolicyInterface::getPolicyDescription(): string
✨ Feature request
Status

Active

Version

11.2 πŸ”₯

Component

other

Created by

πŸ‡ΊπŸ‡ΈUnited States John Franklin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024