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

Examples of org.apache.jackrabbit.api.security.user.UserManager.createGroup()


    protected Group getTestGroup() throws RepositoryException, NotExecutableException {
        if (testGroup == null) {
            // create the testGroup
            Principal principal = new TestPrincipal("testGroup" + UUID.randomUUID());
            UserManager umgr = getUserManager(superuser);
            testGroup = umgr.createGroup(principal);
            testGroup.addMember(testUser);
            if (!umgr.isAutoSave() && superuser.hasPendingChanges()) {
                superuser.save();
            }
        }
View Full Code Here


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

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

        UserManager umgr = getUserManager(uSession);
        Group testGroup = null;
        User self = (User) umgr.getAuthorizable(uID);
        try {
            // let groupadmin create a new group
            testGroup = umgr.createGroup(getTestPrincipal(), "/a/b/c/d");
            save(uSession);

            // editing session adds itself to that group -> must succeed.
            assertTrue(testGroup.addMember(self));
            save(uSession);
View Full Code Here

            // success
        }

        try {
            // let groupadmin create a new group
            testGroup = umgr.createGroup(getTestPrincipal(), "/a/b/c/d");
            save(uSession);

            userAdmin.addMember(testGroup);
            save(uSession);
            userAdmin.removeMember(testGroup);
View Full Code Here

    public void testPersisted() throws NotExecutableException, RepositoryException {
        UserManager umgr = getUserManager(uSession);
        Group gr = null;
        try {
            Principal p = getTestPrincipal();
            gr = umgr.createGroup(p);
            save(uSession);

            // must be visible for the user-mgr attached to another session.
            Authorizable az = userMgr.getAuthorizable(gr.getID());
            assertNotNull(az);
View Full Code Here

        }
        sImpl.save();

        Authorizable administrators = umgr.getAuthorizable(SecurityConstants.ADMINISTRATORS_NAME);
        if (administrators == null) {
            groupIdToRemove = umgr.createGroup(new PrincipalImpl(SecurityConstants.ADMINISTRATORS_NAME)).getID();
            sImpl.save();
        } else if (!administrators.isGroup()) {
            throw new NotExecutableException("Expected " + administrators.getID() + " to be a group.");
        }
    }
View Full Code Here

        Group group2 = null;
        Group group3 = null;
       
        UserManager userMgr = getUserManager(root);
        try {
            group1 = userMgr.createGroup("group1");
            group2 = userMgr.createGroup("group2");
            group3 = userMgr.createGroup("group3");

            group1.addMember(group2);
            group2.addMember(group3);
View Full Code Here

        Group group3 = null;
       
        UserManager userMgr = getUserManager(root);
        try {
            group1 = userMgr.createGroup("group1");
            group2 = userMgr.createGroup("group2");
            group3 = userMgr.createGroup("group3");

            group1.addMember(group2);
            group2.addMember(group3);
           
View Full Code Here

       
        UserManager userMgr = getUserManager(root);
        try {
            group1 = userMgr.createGroup("group1");
            group2 = userMgr.createGroup("group2");
            group3 = userMgr.createGroup("group3");

            group1.addMember(group2);
            group2.addMember(group3);
           
            assertFalse(group3.addMember(group1));
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.