use of com.cognifide.cq.cqsm.foundation.actions.removeall.RemoveAll in project APM by Cognifide.
the class Purge method purge.
private void purge(final Context context, final ActionResult actionResult) throws RepositoryException, ActionExecutionException {
NodeIterator iterator = getPermissions(context);
String normalizedPath = normalizePath(path);
while (iterator != null && iterator.hasNext()) {
Node node = iterator.nextNode();
if (node.hasProperty(PermissionConstants.REP_ACCESS_CONTROLLED_PATH)) {
String parentPath = node.getProperty(PermissionConstants.REP_ACCESS_CONTROLLED_PATH).getString();
String normalizedParentPath = normalizePath(parentPath);
boolean isUsersPermission = parentPath.startsWith(context.getCurrentAuthorizable().getPath());
if (StringUtils.startsWith(normalizedParentPath, normalizedPath) && !isUsersPermission) {
RemoveAll removeAll = new RemoveAll(parentPath);
ActionResult removeAllResult = removeAll.execute(context);
if (Status.ERROR.equals(removeAllResult.getStatus())) {
actionResult.logError(removeAllResult);
}
}
}
}
}
Aggregations