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

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


            String uid = "test";
            while (umgr.getAuthorizable(uid) != null) {
                uid += "_";
            }

            testuser = umgr.createUser(uid, uid);
            userId = testuser.getID();
        } else {
            throw new NotExecutableException();
        }
View Full Code Here


            String uid = "test";
            while (umgr.getAuthorizable(uid) != null) {
                uid += "_";
            }

            testuser = umgr.createUser(uid, uid);
            userId = testuser.getID();
        } else {
            throw new NotExecutableException();
        }
View Full Code Here

        SessionImpl session = (SessionImpl) repository
                .login(new SimpleCredentials("admin", "admin".toCharArray()));
        UserManager userManager = session.getUserManager();
        User user = (User) userManager.getAuthorizable("test");
        if (user == null) {
            user = userManager.createUser("test", "quatloos");
        }
        // set up permissions
        String permissionsPath = session.getRootNode().getPath();
        AccessControlManager accessControlManager = session
                .getAccessControlManager();
View Full Code Here

        UserManager umgr = getUserManager(uSession);
        UserImpl u = null;
        // create a new user -> must succeed and user must be create below 'other'
        try {
            Principal p = getTestPrincipal();
            u = (UserImpl) umgr.createUser(p.getName(), buildPassword(p));
            save(uSession);
            fail("Group administrator should not be allowed to create a new user.");
        } catch (AccessDeniedException e) {
            // success
        } finally {
View Full Code Here

        // create the testGroup
        UserManager umgr = getUserManager(superuser);

        Principal groupPrincipal = new TestPrincipal("testGroup" + UUID.randomUUID());
        testGroup = umgr.createGroup(groupPrincipal);
        testUser = umgr.createUser("testUser" + UUID.randomUUID(), "pw");
        if (!umgr.isAutoSave() && superuser.hasPendingChanges()) {
            superuser.save();
        }
    }
View Full Code Here

            UserManager uMgr = getUserManager(superuser);
            // create the testUser
            uid = "testUser" + UUID.randomUUID();
            creds = new SimpleCredentials(uid, uid.toCharArray());

            testUser = uMgr.createUser(uid, uid);
            if (!uMgr.isAutoSave()) {
                superuser.save();
            }
        } catch (Exception e) {
            superuser.logout();
View Full Code Here

        SessionImpl session = (SessionImpl) repository
                .login(new SimpleCredentials("admin", "admin".toCharArray()));
        UserManager userManager = session.getUserManager();
        User user = (User) userManager.getAuthorizable("test");
        if (user == null) {
            user = userManager.createUser("test", "quatloos");
        }
        // set up permissions
        String permissionsPath = session.getRootNode().getPath();
        AccessControlManager accessControlManager = session
                .getAccessControlManager();
View Full Code Here

     * @throws Exception
     */
    public void testMembershipCacheTraversal() throws Exception {
        UserManager uMgr = getUserManager(superuser);
        //uMgr.autoSave(true);
        User u = uMgr.createUser("any_principal" + UUID.randomUUID(), "foobar");

        // create group with mixin properties
        GroupImpl gr = (GroupImpl) uMgr.createGroup("any_group" + UUID.randomUUID());
        for (int i=0; i<100; i++) {
            User testUser = uMgr.createUser("any_principal" + UUID.randomUUID(), "foobar");
View Full Code Here

        User u = uMgr.createUser("any_principal" + UUID.randomUUID(), "foobar");

        // create group with mixin properties
        GroupImpl gr = (GroupImpl) uMgr.createGroup("any_group" + UUID.randomUUID());
        for (int i=0; i<100; i++) {
            User testUser = uMgr.createUser("any_principal" + UUID.randomUUID(), "foobar");
            gr.addMember(testUser);
        }

        gr.addMember(u);
        NodeImpl n = gr.getNode();
View Full Code Here

        try {
            // create a colliding user node outside of the user tree
            Properties props = new Properties();
            props.setProperty("usersPath", "/testPath");
            UserManager um = new UserManagerImpl((SessionImpl) s, adminId, props);
            User collidingUser = um.createUser(adminId, adminId);
            collidingPath = ((AuthorizableImpl) collidingUser).getNode().getPath();
            s.save();

            // force recreation of admin user.
            s2 = getHelper().getSuperuserSession();
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.