@Test public void testGetPropertyParentNotAccessible() throws Exception { AccessControlManager acMgr = getAccessControlManager(root); JackrabbitAccessControlList acl = AccessControlUtils.getAccessControlList(acMgr, user2.getPath()); acl.addEntry(EveryonePrincipal.getInstance(), privilegesFromNames(PrivilegeConstants.JCR_READ), true); acl.addEntry(EveryonePrincipal.getInstance(), privilegesFromNames(PrivilegeConstants.REP_READ_NODES), false, Collections.emptyMap(), Collections.singletonMap(AccessControlConstants.REP_ITEM_NAMES, new Value[] {getValueFactory(root).createValue("relPath", PropertyType.NAME)})); acMgr.setPolicy(acl.getPath(), acl); root.commit(); try (ContentSession testsession = login(new GuestCredentials())) { Root r = testsession.getLatestRoot(); Authorizable u = getUserManager(r).getAuthorizable(user2.getID()); AuthorizablePropertiesImpl props = new AuthorizablePropertiesImpl((AuthorizableImpl) u, getPartialValueFactory()); assertNull(props.getProperty("relPath/prop")); } }
@Override public Value[] getProperty(@NotNull String relPath) throws RepositoryException { String oakPath = getOakPath(relPath); Tree tree = getTree(); Value[] values = null; PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true); if (property != null) { if (property.isArray()) { List<Value> vs = valueFactory.createValues(property); values = vs.toArray(new Value[0]); } else { values = new Value[]{valueFactory.createValue(property)}; } } return values; }
AuthorizablePropertiesImpl implements AuthorizableProperties { @Override public Value[] getProperty(@NotNull String relPath) throws RepositoryException { String oakPath = getOakPath(relPath); Tree tree = getTree(); Value[] values = null; PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true); if (property != null) { if (property.isArray()) { List<Value> vs = valueFactory.createValues(property); values = vs.toArray(new Value[0]); } else { values = new Value[]{valueFactory.createValue(property)}; } } return values; } }
AuthorizablePropertiesImpl implements AuthorizableProperties { @Override public Value[] getProperty(@NotNull String relPath) throws RepositoryException { String oakPath = getOakPath(relPath); Tree tree = getTree(); Value[] values = null; PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true); if (property != null) { if (property.isArray()) { List<Value> vs = valueFactory.createValues(property); values = vs.toArray(new Value[0]); } else { values = new Value[]{valueFactory.createValue(property)}; } } return values; } AuthorizablePropertiesImpl(@NotNull AuthorizableImpl authorizable,
                               @NotNull PartialValueFactory valueFactory); }
AuthorizablePropertiesImpl implements AuthorizableProperties { @Override public Value[] getProperty(@NotNull String relPath) throws RepositoryException { String oakPath = getOakPath(relPath); Tree tree = getTree(); Value[] values = null; PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true); if (property != null) { if (property.isArray()) { List<Value> vs = valueFactory.createValues(property); values = vs.toArray(new Value[0]); } else { values = new Value[]{valueFactory.createValue(property)}; } } return values; } AuthorizablePropertiesImpl(@NotNull AuthorizableImpl authorizable,
                               @NotNull PartialValueFactory valueFactory); @NotNull @Override Iterator<String> getNames(@NotNull String relPath); @Override boolean hasProperty(@NotNull String relPath); @Override Value[] getProperty(@NotNull String relPath); @Override void setProperty(@NotNull String relPath, @Nullable Value value); @Override void setProperty(@NotNull String relPath, @Nullable Value[] values); @Override boolean removeProperty(@NotNull String relPath); }
AuthorizablePropertiesImpl implements AuthorizableProperties { @Override public Value[] getProperty(@NotNull String relPath) throws RepositoryException { String oakPath = getOakPath(relPath); Tree tree = getTree(); Value[] values = null; PropertyState property = getAuthorizableProperty(tree, getLocation(tree, oakPath), true); if (property != null) { if (property.isArray()) { List<Value> vs = valueFactory.createValues(property); values = vs.toArray(new Value[0]); } else { values = new Value[]{valueFactory.createValue(property)}; } } return values; } AuthorizablePropertiesImpl(@NotNull AuthorizableImpl authorizable,
                               @NotNull PartialValueFactory valueFactory); @NotNull @Override Iterator<String> getNames(@NotNull String relPath); @Override boolean hasProperty(@NotNull String relPath); @Override Value[] getProperty(@NotNull String relPath); @Override void setProperty(@NotNull String relPath, @Nullable Value value); @Override void setProperty(@NotNull String relPath, @Nullable Value[] values); @Override boolean removeProperty(@NotNull String relPath);  }