[MAGNOLIA-6216] Component permissions not found due to broken lookup by name instead of id Created: 22/May/15  Updated: 13/Aug/15  Resolved: 05/Aug/15

Status: Closed
Project: Magnolia
Component/s: page editor
Affects Version/s: 5.3.8
Fix Version/s: 5.3.11, 5.4.1

Type: Bug Priority: Neutral
Reporter: Tobias Mattsson Assignee: Trang Truong
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: 0d
Time Spent: 4d
Original Estimate: 1d

Attachments: PNG File screenshot.png    
Issue Links:
causality
is causing BLOSSOM-208 Permissions on components have no effect Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Sprint 5 (Basel)
Story Points: 8

 Description   

When ComponentElement determines if a user can delete/move/write etc a certain component it will find the definition for the area it is placed in and then lookup the component in its available components map. It does this lookup using the components name instead of its id.

if (areaDefinition != null) {
    String name = componentDefinition.getName();
    ComponentAvailability componentAvailability = areaDefinition.getAvailableComponents().get(name);
    if (componentAvailability != null && componentAvailability.getPermissions() != null) {
        permissions = componentAvailability.getPermissions();
        user = MgnlContext.getUser();
    }
}

Instead of looking it up by name in the name it should loop the map's entries and find it by id.

When no name is explicitly configured a template gets its name set by Content2Bean automatically. Content2Bean uses the name of the node it reads it from. So a component with id: module:components/small/text gets the name text.

This bug means that's impossible to set permissions differently for two components that both have the name text. It also means that the names of the content nodes below availableComponents are significant.

For Blossom templates this bug makes it impossible to set permissions at all since Blossom templates have no name set.


Generated at Mon Feb 12 04:12:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.