private void verifyHierarchy(@NotNull String path) throws CommitFailedException { if (!Text.isDescendant(userRootPath, path)) { String msg = "Attempt to create a token (or it's parent) outside of configured scope " + path; throw constraintViolation(64, msg); } }
private void verifyHierarchy(@Nonnull String path) throws CommitFailedException { if (!Text.isDescendant(userRootPath, path)) { String msg = "Attempt to create a token (or it's parent) outside of configured scope " + path; throw constraintViolation(64, msg); } }
private void verifyHierarchy(@NotNull String path) throws CommitFailedException { if (!Text.isDescendant(userRootPath, path)) { String msg = "Attempt to create a token (or it's parent) outside of configured scope " + path; throw constraintViolation(64, msg); } }
private boolean isAncestor(@NotNull String path) { return Text.isDescendant(path, supportedPath); }
void setSearchRoots(String userSearchRoot, String groupSearchRoot) { this.userSearchRoot = userSearchRoot; this.groupSearchRoot = groupSearchRoot; authorizableSearchRoot = userSearchRoot; while (!Text.isDescendant(authorizableSearchRoot, groupSearchRoot)) { authorizableSearchRoot = Text.getRelativeParent(authorizableSearchRoot, 1); } }
void setSearchRoots(String userSearchRoot, String groupSearchRoot) { this.userSearchRoot = userSearchRoot; this.groupSearchRoot = groupSearchRoot; authorizableSearchRoot = userSearchRoot; while (!Text.isDescendant(authorizableSearchRoot, groupSearchRoot)) { authorizableSearchRoot = Text.getRelativeParent(authorizableSearchRoot, 1); } }
/** * * @param nodePath the node path * @return the node * @throws PathNotFoundException if the node does not exist * @throws RepositoryException if an error occurs */ private NodeImpl getAcNode(String nodePath) throws PathNotFoundException, RepositoryException { if (Text.isDescendant(acRootPath, nodePath)) { return (NodeImpl) session.getNode(nodePath); } else { // node outside of rep:policy tree -> not handled by this editor. return null; } }
/** * * @param nodePath the node path * @return the node * @throws PathNotFoundException if the node does not exist * @throws RepositoryException if an error occurs */ private NodeImpl getAcNode(String nodePath) throws PathNotFoundException, RepositoryException { if (Text.isDescendant(acRootPath, nodePath)) { return (NodeImpl) session.getNode(nodePath); } else { // node outside of rep:policy tree -> not handled by this editor. return null; } }
@Override public boolean childNodeChanged(String name, NodeState before, NodeState after) { if (ROOT_PATH.equals(path) || Text.isDescendant(path, PRIVILEGES_PATH)) { after.compareAgainstBaseState(before, new PrivilegeDiff(this, name, nodeBuilder.child(name))); } return true; } }
@Override public boolean childNodeChanged(String name, NodeState before, NodeState after) { if (ROOT_PATH.equals(path) || Text.isDescendant(path, PRIVILEGES_PATH)) { after.compareAgainstBaseState(before, new PrivilegeDiff(this, name, nodeBuilder.child(name))); } return true; } }
@Override public boolean childNodeChanged(String name, NodeState before, NodeState after) { if (ROOT_PATH.equals(path) || Text.isDescendant(path, PRIVILEGES_PATH)) { after.compareAgainstBaseState(before, new PrivilegeDiff(this, name, nodeBuilder.child(name))); } return true; } }
/** * Build the Group object from the given group node. * * @param groupNode The new group node. * @return An instance of <code>Group</code>. * @throws RepositoryException If the node isn't a child of the configured * groupsPath-node or if another error occurs. */ Group createGroup(NodeImpl groupNode) throws RepositoryException { if (groupNode == null || !groupNode.isNodeType(NT_REP_GROUP)) { throw new IllegalArgumentException(); } if (!Text.isDescendant(groupsPath, groupNode.getPath())) { throw new RepositoryException("Group has to be within the Group Path"); } return doCreateGroup(groupNode); }
/** * Build the User object from the given user node. * * @param userNode The new user node. * @return An instance of <code>User</code>. * @throws RepositoryException If the node isn't a child of the configured * usersPath-node or if another error occurs. */ User createUser(NodeImpl userNode) throws RepositoryException { if (userNode == null || !userNode.isNodeType(NT_REP_USER)) { throw new IllegalArgumentException(); } if (!Text.isDescendant(usersPath, userNode.getPath())) { throw new RepositoryException("User has to be within the User Path"); } return doCreateUser(userNode); }
/** * Build the Group object from the given group node. * * @param groupNode The new group node. * @return An instance of <code>Group</code>. * @throws RepositoryException If the node isn't a child of the configured * groupsPath-node or if another error occurs. */ Group createGroup(NodeImpl groupNode) throws RepositoryException { if (groupNode == null || !groupNode.isNodeType(NT_REP_GROUP)) { throw new IllegalArgumentException(); } if (!Text.isDescendant(groupsPath, groupNode.getPath())) { throw new RepositoryException("Group has to be within the Group Path"); } return doCreateGroup(groupNode); }
private static TreePermission createTreePermission(@NotNull String path) { if (isSupported(path)) { return new TestTreePermission(path); } else if (Text.isDescendant(path, AbstractCompositeProviderTest.TEST_A_PATH)) { return new EmptyTestPermission(path); } else { return TreePermission.NO_RECOURSE; } }
@Test public void testCreateGroupWithPath() throws Exception { UserProvider up = createUserProvider(4); // create test user Tree group = up.createGroup("authors", "a/b/c"); assertNotNull(group); assertTrue(Text.isDescendant(customGroupPath, group.getPath())); String groupPath = customGroupPath + "/a/b/c/authors"; assertEquals(groupPath, group.getPath()); }
@Test public void testCreateUserWithPath() throws Exception { UserProvider up = createUserProvider(1); // create test user Tree userTree = up.createUser("nadine", "a/b/c"); assertNotNull(userTree); assertTrue(Text.isDescendant(customUserPath, userTree.getPath())); String userPath = customUserPath + "/a/b/c/nadine"; assertEquals(userPath, userTree.getPath()); }
public void testCreateGroupWithIntermediatePath() throws RepositoryException, NotExecutableException { UserManager umgr = getUserManager(uSession); Group testGroup = null; try { testGroup = umgr.createGroup(getTestPrincipal(), "/any/intermediate/path"); save(uSession); assertTrue(Text.isDescendant(groupsPath + "/any/intermediate/path", ((GroupImpl)testGroup).getNode().getPath())); } finally { if (testGroup != null) { testGroup.remove(); save(uSession); } } }
public void testCreateGroup() throws RepositoryException, NotExecutableException { UserManager umgr = getUserManager(uSession); Group testGroup = null; try { testGroup = umgr.createGroup(getTestPrincipal()); save(uSession); assertTrue(Text.isDescendant(groupsPath, ((GroupImpl)testGroup).getNode().getPath())); } finally { if (testGroup != null) { testGroup.remove(); save(uSession); } } }
@Test public void testCreateGroup() throws RepositoryException { UserProvider up = createUserProvider(); Tree groupTree = up.createGroup("group1", null); assertNotNull(groupTree); assertTrue(Text.isDescendant(defaultGroupPath, groupTree.getPath())); int level = defaultConfig.getConfigValue(UserConstants.PARAM_DEFAULT_DEPTH, UserConstants.DEFAULT_DEPTH) + 1; assertEquals(defaultGroupPath, Text.getRelativeParent(groupTree.getPath(), level)); }