use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.
the class MoveAwarePermissionValidator method visibleValidator.
private Validator visibleValidator(@Nonnull Tree source, @Nonnull Tree dest) {
// TODO improve: avoid calculating the 'before' permissions in case the current parent permissions already point to the correct tree.
ImmutableTree immutableTree = (ImmutableTree) moveCtx.rootBefore.getTree("/");
TreePermission tp = getPermissionProvider().getTreePermission(immutableTree, TreePermission.EMPTY);
for (String n : PathUtils.elements(source.getPath())) {
immutableTree = immutableTree.getChild(n);
tp = tp.getChildPermission(n, immutableTree.getNodeState());
}
Validator validator = createValidator(source, dest, tp, this);
return new VisibleValidator(validator, true, false);
}
use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.
the class UserValidatorTest method hiddenNodeChanged.
@Test
public void hiddenNodeChanged() throws CommitFailedException {
UserValidatorProvider provider = new UserValidatorProvider(getConfig());
MemoryNodeStore store = new MemoryNodeStore();
NodeBuilder builder = store.getRoot().builder();
builder.child("test").child(":hidden");
NodeState root = builder.getNodeState();
NodeBuilder test = root.builder().child("test");
NodeBuilder hidden = test.child(":hidden");
hidden.child("added");
Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
Validator childValidator = validator.childNodeChanged("test", root.getChildNode("test"), test.getNodeState());
assertNotNull(childValidator);
Validator hiddenValidator = childValidator.childNodeChanged(":hidden", root.getChildNode("test").getChildNode(":hidden"), hidden.getNodeState());
assertNull(hiddenValidator);
}
use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.
the class UserValidatorTest method hiddenNodeAdded.
@Test
public void hiddenNodeAdded() throws CommitFailedException {
UserValidatorProvider provider = new UserValidatorProvider(getConfig());
MemoryNodeStore store = new MemoryNodeStore();
NodeState root = store.getRoot();
NodeBuilder builder = root.builder();
NodeBuilder test = builder.child("test");
NodeBuilder hidden = test.child(":hidden");
Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
Validator childValidator = validator.childNodeAdded("test", test.getNodeState());
assertNotNull(childValidator);
Validator hiddenValidator = childValidator.childNodeAdded(":hidden", hidden.getNodeState());
assertNull(hiddenValidator);
}
use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.
the class AccessControlValidatorTest method hiddenNodeChanged.
@Test
public void hiddenNodeChanged() throws CommitFailedException {
AccessControlValidatorProvider provider = new AccessControlValidatorProvider(getSecurityProvider());
MemoryNodeStore store = new MemoryNodeStore();
NodeBuilder builder = store.getRoot().builder();
builder.child("test").child(":hidden");
NodeState root = builder.getNodeState();
NodeBuilder test = root.builder().child("test");
NodeBuilder hidden = test.child(":hidden");
hidden.child("added");
Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
Validator childValidator = validator.childNodeChanged("test", root.getChildNode("test"), test.getNodeState());
assertNotNull(childValidator);
Validator hiddenValidator = childValidator.childNodeChanged(":hidden", root.getChildNode("test").getChildNode(":hidden"), hidden.getNodeState());
assertNull(hiddenValidator);
}
use of org.apache.jackrabbit.oak.spi.commit.Validator in project jackrabbit-oak by apache.
the class AccessControlValidatorTest method hiddenNodeAdded.
@Test
public void hiddenNodeAdded() throws CommitFailedException {
AccessControlValidatorProvider provider = new AccessControlValidatorProvider(getSecurityProvider());
MemoryNodeStore store = new MemoryNodeStore();
NodeState root = store.getRoot();
NodeBuilder builder = root.builder();
NodeBuilder test = builder.child("test");
NodeBuilder hidden = test.child(":hidden");
Validator validator = provider.getRootValidator(root, builder.getNodeState(), CommitInfo.EMPTY);
Validator childValidator = validator.childNodeAdded("test", test.getNodeState());
assertNotNull(childValidator);
Validator hiddenValidator = childValidator.childNodeAdded(":hidden", hidden.getNodeState());
assertNull(hiddenValidator);
}
Aggregations