[BLOSSOM-208] Permissions on components have no effect Created: 22/May/15  Updated: 03/Jul/15  Resolved: 24/May/15

Status: Closed
Project: Blossom
Component/s: None
Affects Version/s: 3.0.6
Fix Version/s: 3.0.7

Type: Bug Priority: Neutral
Reporter: Tobias Mattsson Assignee: Tobias Mattsson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MAGNOLIA-6216 Component permissions not found due t... 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:

 Description   

Permissions set on areas to control use of components within them have no effect on blossom components. This is caused by MAGNOLIA-6216 and should be fixed there.

Blossom sets the name of templates to be the same as their ids. Which should be fine except the page editor incorrectly uses the name instead of the id.

Blossom should try to set the name identically to how Content2Bean does just to be safe and circumvent this bug until its been fixed.

These workarounds works in current and previous versions of Blossom.

Workaround using Java config
@Bean
public TemplateExporter templateExporter() {
    TemplateExporter templateExporter = new TemplateExporter();
    templateExporter.setTemplateDefinitionBuilder( new TemplateDefinitionBuilder() {
        @Override
        public BlossomTemplateDefinition buildTemplateDefinition(BlossomDispatcher dispatcher, DetectedHandlersMetaData detectedHandlers, HandlerMetaData template) {
            BlossomTemplateDefinition definition = super.buildTemplateDefinition(dispatcher, detectedHandlers, template);
            definition.setName(StringUtils.substringAfterLast(definition.getId(), "/"));
            return definition;
        }
    });
    return templateExporter;
}
Workaround using XML config
<bean class="info.magnolia.module.blossom.template.TemplateExporter">
  <property name="templateDefinitionBuilder">
    <bean class="info.magnolia.blossom.sample.module.CustomTemplateDefinitionBuilder" />
  </property>
</bean>
package info.magnolia.blossom.sample.module;

import info.magnolia.module.blossom.dispatcher.BlossomDispatcher;
import info.magnolia.module.blossom.template.BlossomTemplateDefinition;
import info.magnolia.module.blossom.template.DetectedHandlersMetaData;
import info.magnolia.module.blossom.template.HandlerMetaData;
import info.magnolia.module.blossom.template.TemplateDefinitionBuilder;

import org.apache.commons.lang.StringUtils;

public class CustomTemplateDefinitionBuilder extends TemplateDefinitionBuilder {

    @Override
    public BlossomTemplateDefinition buildTemplateDefinition(BlossomDispatcher dispatcher, DetectedHandlersMetaData detectedHandlers, HandlerMetaData template) {
        BlossomTemplateDefinition definition = super.buildTemplateDefinition(dispatcher, detectedHandlers, template);
        definition.setName(StringUtils.substringAfterLast(definition.getId(), "/"));
        return definition;
    }
}


 Comments   
Comment by Jan Haderka [ 16/Jun/15 ]

test?

Generated at Sun Feb 11 23:31:13 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.