Package org.apache.jackrabbit.api.security.user

Examples of org.apache.jackrabbit.api.security.user.Group.addMember()


            save(uSession);

            // add child-user to test group
            Authorizable testUser = umgr.getAuthorizable(getYetAnotherID());
            assertFalse(testGroup.isMember(testUser));
            assertTrue(testGroup.addMember(testUser));
            save(uSession);
        } finally {
            if (testGroup != null) {
                for (Iterator<Authorizable> it = testGroup.getDeclaredMembers(); it.hasNext();) {
                    testGroup.removeMember(it.next());
View Full Code Here


        Authorizable pU = umgr.getAuthorizable(otherUID);
        Group gr = (Group) umgr.getAuthorizable(groupAdmin.getID());

        try {
            assertTrue(gr.addMember(pU));
            save(uSession);
        } finally {
            gr.removeMember(pU);
            save(uSession);
        }
View Full Code Here

        Authorizable user = umgr.getAuthorizable(uID);
        Group gr = (Group) umgr.getAuthorizable(groupAdmin.getID());

        // user is already group-admin -> adding must return false.
        // but should not throw exception.
        assertFalse(gr.addMember(user));
    }

    public void testRemoveMembershipForOwnAuthorizable() throws RepositoryException, NotExecutableException {
        UserManager umgr = getUserManager(uSession);
View Full Code Here

            save(superuser);

            p = getTestPrincipal();
            nUs2 = userMgr.createUser(p.getName(), buildPassword(p));
            save(superuser);
            nGr.addMember(nUs);
            nGr.addMember(nUs2);
            save(superuser);

            UserManager umgr = getUserManager(uSession);
            Group gr = (Group) umgr.getAuthorizable(nGr.getID());
View Full Code Here

            p = getTestPrincipal();
            nUs2 = userMgr.createUser(p.getName(), buildPassword(p));
            save(superuser);
            nGr.addMember(nUs);
            nGr.addMember(nUs2);
            save(superuser);

            UserManager umgr = getUserManager(uSession);
            Group gr = (Group) umgr.getAuthorizable(nGr.getID());
View Full Code Here

            // let superuser create a group and a user a make user member of group
            nGr = userMgr.createGroup(getTestPrincipal());
            save(superuser);
            Principal p = getTestPrincipal();
            nUs = userMgr.createUser(p.getName(), buildPassword(p));
            nGr.addMember(nUs);
            save(superuser);

            UserManager umgr = getUserManager(uSession);
            Group gr = (Group) umgr.getAuthorizable(nGr.getID());
View Full Code Here

            gr2 = userMgr.createGroup(getTestPrincipal());
            save(superuser);


            gr1.addMember(gr2);
            gr2.addMember(u);
            save(superuser);

            PrincipalIterator it = principalProvider.getGroupMembership(u.getPrincipal());
            while (it.hasNext()) {
                Principal p = it.nextPrincipal();
View Full Code Here

                        if (!gr.removeMember(m)) {
                            handleFailure("Failed remove existing member (" + m + ") from " + gr);
                        }
                    }
                    for (Authorizable m : toAdd) {
                        if (!gr.addMember(m)) {
                            handleFailure("Failed add member (" + m + ") to " + gr);
                        }
                    }

                    // handling non-existing members in case of best-effort
View Full Code Here

            group3 = userMgr.createGroup("group3");

            group1.addMember(group2);
            group2.addMember(group3);
           
            assertFalse(group3.addMember(group1));
           
            Tree group3Tree = root.getTree(group3.getPath());
            Set<String> values = Collections.singleton(root.getTree(group1.getPath()).getProperty(JcrConstants.JCR_UUID).getValue(Type.STRING));
            PropertyState prop = PropertyStates.createProperty(REP_MEMBERS, values, Type.WEAKREFERENCES);
            group3Tree.setProperty(prop);
View Full Code Here

                if (!gr.removeMember(m)) {
                    handleFailure("Failed remove existing member (" + m + ") from " + gr);
                }
            }
            for (Authorizable m : toAdd) {
                if (!gr.addMember(m)) {
                    handleFailure("Failed add member (" + m + ") to " + gr);
                }
            }

            // handling non-existing members in case of best-effort
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.