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

Examples of org.apache.jackrabbit.api.security.user.Authorizable


     *
     * @throws RepositoryException
     * @throws NotExecutableException
     */
    public void testCollidingAdminNode() throws RepositoryException, NotExecutableException {
        Authorizable admin = userMgr.getAuthorizable(adminId);

        if (admin == null || !(admin instanceof AuthorizableImpl)) {
            throw new NotExecutableException();
        }

View Full Code Here


        save(superuser);

        otherUID = other.getID();

        // make other user a user-administrator:
        Authorizable ua = userMgr.getAuthorizable(UserConstants.USER_ADMIN_GROUP_NAME);
        if (ua == null || !ua.isGroup()) {
            throw new NotExecutableException("Cannot execute test. No user-administrator group found.");
        }
        uAdministrators = (Group) ua;
        uAdministrators.addMember(other);
View Full Code Here

        try {
            if (otherSession != null) {
                otherSession.logout();
            }
        } finally {
            Authorizable a = userMgr.getAuthorizable(otherUID);
            if (a != null) {
                for (Iterator<Group> it = a.memberOf(); it.hasNext();) {
                    Group gr = it.next();
                    if (!gr.getPrincipal().equals(EveryonePrincipal.getInstance())) {
                        gr.removeMember(a);
                    }
                }
                a.remove();
            }
            a = userMgr.getAuthorizable(uID);
            if (a != null) {
                a.remove();
            }
            save(superuser);
        }
        super.tearDown();
    }
View Full Code Here

        }
        super.tearDown();
    }

    private Group getGroupAdminGroup(UserManager uMgr) throws RepositoryException, NotExecutableException {
        Authorizable auth = uMgr.getAuthorizable(UserConstants.GROUP_ADMIN_GROUP_NAME);
        if (auth == null || !auth.isGroup()) {
            throw new NotExecutableException();
        }
        return (Group) auth;
    }
View Full Code Here

    }

    public void testRemoveHimSelf() throws RepositoryException, NotExecutableException {
        UserManager umgr = getUserManager(otherSession);

        Authorizable himself = umgr.getAuthorizable(otherUID);
        try {
            himself.remove();
            save(otherSession);

            fail("A UserAdministrator should not be allowed to remove himself.");
        } catch (AccessDeniedException e) {
            // success
View Full Code Here

     * @throws NotExecutableException
     */
    public void testRemoveAnotherUser() throws RepositoryException, NotExecutableException {
        UserManager umgr = getUserManager(otherSession);

        Authorizable user = umgr.getAuthorizable(uID);
        user.remove();
        save(otherSession);
    }
View Full Code Here

        } catch (RepositoryException e) {
            // success.
        } finally {
            // let superuser clean up
            if (grId != null) {
                Authorizable gr = userMgr.getAuthorizable(grId);
                if (gr != null) {
                    gr.remove();
                    save(superuser);
                }
            }
        }
    }
View Full Code Here

        } catch (RepositoryException e) {
            // success.
        } finally {
            // let superuser clean up
            if (grId != null) {
                Authorizable gr = userMgr.getAuthorizable(grId);
                if (gr != null) {
                    gr.remove();
                    save(superuser);
                }
            }
        }
    }
View Full Code Here

    public void testAddToGroup() throws NotExecutableException, RepositoryException {
        UserManager umgr = getUserManager(otherSession);
        Group gr = getGroupAdminGroup(umgr);

        Authorizable auth = umgr.getAuthorizable(uID);
        try {
            assertFalse(gr.addMember(auth));
            // omit cond-save call.
        } catch (AccessDeniedException e) {
            // success as well.
View Full Code Here

        try {
            Principal p = getTestPrincipal();
            u = (UserImpl) umgr.createUser(p.getName(), buildPassword(p));
            save(otherSession);

            Authorizable az = userMgr.getAuthorizable(u.getID());
            assertNotNull(az);
            assertEquals(u.getID(), az.getID());
        } finally {
            if (u != null) {
                u.remove();
                save(otherSession);
            }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.api.security.user.Authorizable

Copyright © 2018 www.massapicom. 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.