Uploaded image for project: 'Blossom'
  1. Blossom
  2. BLOSSOM-208

Permissions on components have no effect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 3.0.7
    • 3.0.6
    • None
    • None

      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;
          }
      }
      

        Acceptance criteria

              tmattsson Tobias Mattsson
              tmattsson Tobias Mattsson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD