use of org.apache.jackrabbit.vault.fs.filter.DefaultPathFilter in project acs-aem-commons by Adobe-Consulting-Services.
the class AuthorizablePackagerServletImpl method findPaths.
private List<PathFilterSet> findPaths(final ResourceResolver resourceResolver, final String[] authorizableIds) throws RepositoryException {
final UserManager userManager = resourceResolver.adaptTo(UserManager.class);
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final String authorizableId : authorizableIds) {
try {
final Authorizable authorizable = userManager.getAuthorizable(authorizableId);
if (authorizable != null) {
final String path = authorizable.getPath();
final PathFilterSet principal = new PathFilterSet(path);
// Exclude tokens as they are not vlt installable in AEM6/Oak
principal.addExclude(new DefaultPathFilter(path + "/\\.tokens"));
pathFilterSets.add(principal);
}
} catch (RepositoryException e) {
log.warn("Unable to find path for authorizable " + authorizableId, e);
}
}
return pathFilterSets;
}
use of org.apache.jackrabbit.vault.fs.filter.DefaultPathFilter in project sling by apache.
the class VltUtils method createFilter.
public static WorkspaceFilter createFilter(DistributionRequest distributionRequest, NavigableMap<String, List<String>> nodeFilters, NavigableMap<String, List<String>> propertyFilters) {
DefaultWorkspaceFilter filter = new DefaultWorkspaceFilter();
for (String path : distributionRequest.getPaths()) {
// Set node path filters
List<String> patterns = new ArrayList<String>();
patterns.addAll(Arrays.asList(distributionRequest.getFilters(path)));
boolean deep = distributionRequest.isDeep(path);
PathFilterSet nodeFilterSet = new PathFilterSet(path);
if (!deep) {
nodeFilterSet.addInclude(new DefaultPathFilter(path));
}
initFilterSet(nodeFilterSet, nodeFilters, patterns);
filter.add(nodeFilterSet);
// Set property path filters
PathFilterSet propertyFilterSet = new PathFilterSet("/");
initFilterSet(propertyFilterSet, propertyFilters, new ArrayList<String>());
filter.addPropertyFilterSet(propertyFilterSet);
}
return filter;
}
use of org.apache.jackrabbit.vault.fs.filter.DefaultPathFilter in project acs-aem-commons by Adobe-Consulting-Services.
the class ACLPackagerServletImpl method getPrincipalResources.
/**
* Gets the resources for the param principals.
*
* @param resourceResolver the ResourceResolver obj to get the principal resources;
* Must have read access to the principal resources.
* @param principalNames the principals to get
* @return a list of PathFilterSets covering the selectes principal names (if they exist)
* @throws RepositoryException
*/
private List<PathFilterSet> getPrincipalResources(final ResourceResolver resourceResolver, final String[] principalNames) throws RepositoryException {
final UserManager userManager = resourceResolver.adaptTo(UserManager.class);
final List<PathFilterSet> pathFilterSets = new ArrayList<PathFilterSet>();
for (final String principalName : principalNames) {
final Authorizable authorizable = userManager.getAuthorizable(principalName);
if (authorizable != null) {
final Resource resource = resourceResolver.getResource(authorizable.getPath());
if (resource != null) {
final PathFilterSet principal = new PathFilterSet(resource.getPath());
// Exclude tokens as they are not vlt installable in AEM6/Oak
principal.addExclude(new DefaultPathFilter(resource.getPath() + "/\\.tokens"));
pathFilterSets.add(principal);
}
}
}
return pathFilterSets;
}
Aggregations