Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-14807

Fix 'Add Page' in the Channel Manager when a campaign is running

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 14.6.3, 14.7.0
    • None
    • None
    • Quasar
    • Puma sprint 270

    Description

      This is quite a delicate scenario, and differs between PaaS and SaaS.

      In CMS-14806, we have backported that the Channel Mgr 'rest' kind of interactions are marked in the HstRequestContext as 'ChannelManagerRequestType#REST' requests.

      When a request is marked as such, it results in that the 'DelegatingHstSiteProvider' will use the 'channelManagerHstSiteProvider' : As a result, then for example when requesting HstSite#getChannel, instead of the MASTER, a branch might be returned.

      Now, this is problematic in ChannelServiceImpl

      @Override
          public Map<String, XPageLayout> getXPageLayouts(final String channelId) {
            
              for (HstModel hstModel : hstModelRegistry.getModels().values()) {
      
                  HippoWebappContext context = HippoWebappContextRegistry.get().getContext(hstModel.getVirtualHosts().getContextPath());
      
                  if (context == null) {
                      continue;
                  }
                  if (CMS_OR_PLATFORM.contains(context.getType())) {
                      continue;
                  }
      
                  final VirtualHosts virtualHosts = hstModel.getVirtualHosts();
      
                  // just find the first Mount which have a matching channel id, and create the XPageLayout from that
                  // channel (it doesn't matter through which hostgroup the channel is found
      
                  // note that 'channelId' can be for a branch as well!
      
                  final Optional<Map<String, HstComponentConfiguration>> xPageLayoutComponents = virtualHosts.getHostGroupNames().stream()
                          .filter(hostgroupName -> virtualHosts.getChannelById(hostgroupName, channelId) != null)
                          .flatMap(hostgroupName -> virtualHosts.getMountsByHostGroup(hostgroupName).stream()).collect(Collectors.toList())
                          .stream()
                          .filter(mount -> mount.getChannel() != null && channelId.equals(mount.getChannel().getId()))
                          .map(mount -> mount.getHstSite().getComponentsConfiguration().getXPages())
                          .findFirst();
      
                  if (!xPageLayoutComponents.isPresent()) {
                      log.info("Cannot find any XPageLayouts for channel '{}'", channelId);
                      continue;
                  } else {
                      return getXPageLayouts(xPageLayoutComponents.get());
                  }
              }
      
              return Collections.emptyMap();
          }
      

      The problem is that for PaaS, the argument 'channelId' is always of MASTER, but due to the 'channel mgr context' of the request, the 'mount.getChannel().getId()' can return a branch id, which is never equal to the MASTER 'channelId'

      Therefore, for PaaS, we need only for this method, SET the request context to 'CONTEXT-LESS', and at the end of the method, set it again back to what it was.

      Note this has an impediment on ENT-3708 which will add the 'CONTEXT-LESS' support for the HstRequestContext and DelegatingHstSiteProvider

      puma-qa-team Note to also test that when the branch is not running as campaign, that both in the branch as well as for the master, a new XPage Doc can be created in the CM

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aschrijvers Ard Schrijvers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: