Make it possible to declare access callback on per EntityInformation plugin

Created on 29 June 2023, over 1 year ago
Updated 19 July 2023, over 1 year ago

Problem/Motivation

In our application, we would like some plugins only available to users with specific roles. For example - EntityInformationPathAlias should be available only to user with `administer url aliases` permission. This is not only limited to permission - some plugins can only be available based on some computations, ex. if entity has a field_foo and field_foo has value bar then plugin should be available, hidden otherwise.

Steps to reproduce

n/a

Proposed resolution

Introduce AccessAwareInterface with an ::access(AccountInterface $account, EntityInterface $entity) method
In EntityInformationController::render() only show plugins that are accessible if they implement AccessAwareInterface

User interface changes

n/a

API changes

Additions only, no change for current users is expected

Data model changes

Additions only, no change for current users is expected

✨ Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡³πŸ‡΄Norway zaporylie

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

Comments & Activities

Production build 0.71.5 2024