code: @Override
    public @NotNull Set<String> getAllowedComponents(@NotNull Page page, @NotNull String relativeResourcePath,
        @Nullable String resourceType, @NotNull ResourceResolver resolver) {
      Set<String> allowedComponents = new HashSet<>();
      Set<String> deniedComponents = new HashSet<>();
  
      String pageComponentPath = page.getContentResource().getResourceType();
  
      Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentPath, relativeResourcePath, resolver);
  
      Resource parentResource = null;
      Resource grandParentResource = null;
  
      for (ParsysConfig pathDef : parSysConfigs) {
  
        boolean includePathDef = false;
        if (pathDef.getAllowedParents().size() == 0) {
          includePathDef = true;
        }
        else {
          String checkResourceType = null;
          if (pathDef.getParentAncestorLevel() == 1) {
            if (resourceType != null) {
              checkResourceType = resourceType;
            }
            else if (parentResource == null) {
              parentResource = resolver.getResource(page.getPath() + "/" + relativeResourcePath);
              if (parentResource != null) {
                checkResourceType = parentResource.getResourceType();
              }
            }
          }
          else if (pathDef.getParentAncestorLevel() == 2) {
            if (grandParentResource == null) {
              grandParentResource = resolver.getResource(page.getPath() + "/" + relativeResourcePath + "/..");
            }
            if (grandParentResource != null) {
              checkResourceType = grandParentResource.getResourceType();
            }
          }
          if (checkResourceType != null) {
            includePathDef = pathDef.getAllowedParents().contains(checkResourceType);
          }
        }
  
        if (includePathDef) {
          allowedComponents.addAll(pathDef.getAllowedChildren());
          deniedComponents.addAll(pathDef.getDeniedChildren());
        }
  
      }
  
      // filter out denied components
      allowedComponents.removeAll(deniedComponents);
  
      return allowedComponents;
    }
docs: Get allowed components for a specific resource path inside a page.
  @param page Page
  @param relativeResourcePath Relative resource path inside the page
  @param resourceType Resource type of the paragraph system
  @param resolver Resource resolver
  @return Component paths