private boolean isTemplateVisibleAccordingToApplication( PublicationTemplate template, GlobalContext context, OrganisationController oc) { List<String> restrictedApplications = template.getApplications(); String componentName = context.getComponentName(); if (StringUtil.isDefined(context.getComponentId())) { ComponentInstLight component = oc.getComponentInstLight(context.getComponentId()); componentName = component.getName(); } return restrictedApplications.contains(componentName); }
private boolean isTemplateVisibleAccordingToSpace( PublicationTemplate template, GlobalContext context, OrganisationController oc) { List<String> restrictedSpaceIds = template.getSpaces(); List<SpaceInst> spacePath = oc.getSpacePath(context.getSpaceId()); for (SpaceInst space : spacePath) { String spaceId = space.getId(); if (!spaceId.startsWith(Admin.SPACE_KEY_PREFIX)) { spaceId = Admin.SPACE_KEY_PREFIX + spaceId; } if (restrictedSpaceIds.contains(spaceId)) { return true; } } return false; }
private boolean isTemplateVisibleAccordingToInstance( PublicationTemplate template, GlobalContext context) { List<String> restrictedInstanceIds = template.getInstances(); return restrictedInstanceIds.contains(context.getComponentId()); }