Validator checkPermissions(@Nonnull ImmutableTree tree, boolean isBefore,
long defaultPermission) throws CommitFailedException {
long toTest = getPermission(tree, defaultPermission);
if (Permissions.isRepositoryPermission(toTest)) {
if (!permissionProvider.getRepositoryPermission().isGranted(toTest)) {
throw new CommitFailedException(ACCESS, 0, "Access denied");
}
return null; // no need for further validation down the subtree
} else {
TreePermission tp = parentPermission.getChildPermission(tree.getName(), tree.getNodeState());
if (!tp.isGranted(toTest)) {
throw new CommitFailedException(ACCESS, 0, "Access denied");
}
if (noTraverse(toTest, defaultPermission)) {
return null;
} else {
return (isBefore) ?