Package org.apache.jackrabbit.oak.spi.security.user

Examples of org.apache.jackrabbit.oak.spi.security.user.UserProvider.createGroup()


    @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(UserConfig.PARAM_DEFAULT_DEPTH, UserConstants.DEFAULT_DEPTH) + 1;
View Full Code Here


    @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());
    }
View Full Code Here

            }
        }

        for (String uid : colliding.keySet()) {
            try {
                Tree c = userProvider.createGroup(uid, colliding.get(uid));
                root.commit(DefaultConflictHandler.OURS);
                fail("userID collision must be detected");
            } catch (CommitFailedException e) {
                // success
            }
View Full Code Here

        String userID = "hannah";
        String groupID = "cLevel";

        Tree user = up.createUser(userID, null);
        Tree group = up.createGroup(groupID, null);
        root.commit(DefaultConflictHandler.OURS);

        Tree a = up.getAuthorizable(userID);
        assertNotNull(a);
        assertEquals(user.getPath(), a.getPath());
View Full Code Here

        assertNotNull(up.getAuthorizable(userID, Type.AUTHORIZABLE));
        assertNull(up.getAuthorizable(userID, Type.GROUP));

        String groupID = "hr";
        Tree group = up.createGroup(groupID, null);
        root.commit(DefaultConflictHandler.OURS);

        Tree g = up.getAuthorizable(groupID, Type.GROUP);
        assertNotNull(a);
        assertEquals(user.getPath(), a.getPath());
View Full Code Here

        Tree user = up.createUser("shams", null);
        Tree a = up.getAuthorizableByPath(user.getPath());
        assertNotNull(a);
        assertEquals(user, a);

        Tree group = up.createGroup("devs", null);
        a = up.getAuthorizableByPath(group.getPath());
        assertNotNull(a);
        assertEquals(group, a);
    }
View Full Code Here

        Tree adminTree = userProvider.createUser(defaultConfig.getAdminId(), null);
        userProvider.isAdminUser(adminTree);

        List<Tree> others = new ArrayList<Tree>();
        others.add(userProvider.createUser("laura", null));
        others.add(userProvider.createGroup("administrators", null));

        for (Tree other : others) {
            assertFalse(userProvider.isAdminUser(other));
        }
    }
View Full Code Here

        assertEquals(userID, up.getAuthorizableId(user, Type.USER));
        assertEquals(userID, up.getAuthorizableId(user, Type.AUTHORIZABLE));
        assertNull(up.getAuthorizableId(user, Type.GROUP));

        String groupID = "visitors";
        Tree group = up.createGroup(groupID, null);
        assertEquals(groupID, up.getAuthorizableId(group, Type.GROUP));
        assertEquals(groupID, up.getAuthorizableId(group, Type.AUTHORIZABLE));
        assertNull(up.getAuthorizableId(group, Type.USER));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.