this(getTreePermission(permissionProvider, after.exists() ? after : before, basePath));
}
private static TreePermission getTreePermission(PermissionProvider permissionProvider,
NodeState root, String basePath) {
TreePermission treePermission = permissionProvider.getTreePermission(
new ImmutableTree(root), TreePermission.EMPTY);
for (String name : PathUtils.elements(basePath)) {
root = root.getChildNode(name);
treePermission = treePermission.getChildPermission(name, root);
}
return treePermission;
}