use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class AuthorizablePropertiesImpl method getNames.
//---------------------------------------------< AuthorizableProperties >---
@Nonnull
@Override
public Iterator<String> getNames(@Nonnull String relPath) throws RepositoryException {
String oakPath = getOakPath(relPath);
Tree tree = getTree();
TreeLocation location = getLocation(tree, oakPath);
Tree parent = location.getTree();
if (parent != null && Text.isDescendantOrEqual(tree.getPath(), parent.getPath())) {
List<String> l = new ArrayList<String>();
for (PropertyState property : parent.getProperties()) {
String propName = property.getName();
if (isAuthorizableProperty(tree, location.getChild(propName), false)) {
l.add(namePathMapper.getJcrName(propName));
}
}
return l.iterator();
} else {
throw new RepositoryException("Relative path " + relPath + " refers to non-existing tree or tree outside of scope of authorizable.");
}
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class AuthorizablePropertiesImpl method setProperty.
/**
* @see org.apache.jackrabbit.api.security.user.Authorizable#setProperty(String, javax.jcr.Value)
*/
@Override
public void setProperty(@Nonnull String relPath, @Nullable Value value) throws RepositoryException {
if (value == null) {
removeProperty(relPath);
} else {
String oakPath = getOakPath(relPath);
String name = Text.getName(oakPath);
PropertyState propertyState = PropertyStates.createProperty(name, value);
String intermediate = (oakPath.equals(name)) ? null : Text.getRelativeParent(oakPath, 1);
Tree parent = getOrCreateTargetTree(intermediate);
checkProtectedProperty(parent, propertyState);
parent.setProperty(propertyState);
}
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class RestrictionProviderImpl method validateRestrictions.
@Override
public void validateRestrictions(String oakPath, @Nonnull Tree aceTree) throws AccessControlException {
super.validateRestrictions(oakPath, aceTree);
Tree restrictionsTree = getRestrictionsTree(aceTree);
PropertyState glob = restrictionsTree.getProperty(REP_GLOB);
if (glob != null) {
GlobPattern.validate(glob.getValue(Type.STRING));
}
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class PrincipalRestrictionProvider method readRestrictions.
@Nonnull
@Override
public Set<Restriction> readRestrictions(@Nullable String oakPath, @Nonnull Tree aceTree) {
Set<Restriction> restrictions = new HashSet<Restriction>(base.readRestrictions(oakPath, aceTree));
String value = (oakPath == null) ? "" : oakPath;
PropertyState nodePathProp = PropertyStates.createProperty(REP_NODE_PATH, value, Type.PATH);
restrictions.add(new RestrictionImpl(nodePathProp, true));
return restrictions;
}
use of org.apache.jackrabbit.oak.api.PropertyState in project jackrabbit-oak by apache.
the class AbstractCompositeProviderTest method testTreePermissionIsNotGranted.
@Test
public void testTreePermissionIsNotGranted() throws Exception {
PermissionProvider pp = createPermissionProvider();
TreePermission parentPermission = TreePermission.EMPTY;
PropertyState ps = PropertyStates.createProperty("propName", "val");
for (String path : TP_PATHS) {
Tree t = readOnlyRoot.getTree(path);
TreePermission tp = pp.getTreePermission(t, parentPermission);
assertFalse(tp.isGranted(Permissions.NO_PERMISSION));
assertFalse(tp.isGranted(Permissions.MODIFY_ACCESS_CONTROL));
assertFalse(tp.isGranted(Permissions.NO_PERMISSION, ps));
assertFalse(tp.isGranted(Permissions.MODIFY_ACCESS_CONTROL, ps));
parentPermission = tp;
}
}
Aggregations