Change the label if user does not have access to the underlying entity

Created on 26 September 2023, about 1 year ago
Updated 12 December 2023, about 1 year ago

Problem/Motivation

Per SA-CORE-2022-004 โ†’ , it's possible the user might not have access to the underlying entity. In such cases, the label should be changed.

Suggested by xjm:

   public function generateEntityMetadata(EntityInterface $entity) {
     return [
-      'label' => $entity->label(),
+      'label' => $entity->access('view label') ? $entity->label() : new TranslatableMarkup('@label @id', [
+        '@label' => $entity->getEntityType()->getSingularLabel(),
+        '@id' => $entity->id()
+      ])
     ];
   }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Fixed

Version

2.0

Component

User interface

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States DamienMcKenna NH, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024