Examples of PrincipalIterator


Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

                searchType = PrincipalManager.SEARCH_TYPE_NOT_GROUP;
            } else if (SYSTEM_USER_MANAGER_GROUP_PATH.equals(path)) {
                searchType = PrincipalManager.SEARCH_TYPE_GROUP;
            }
            if (searchType != -1) {
                PrincipalIterator principals = null;
                Session session = resourceResolver.adaptTo(Session.class);
                if (session != null) {
                    PrincipalManager principalManager = AccessControlUtil.getPrincipalManager(session);
                    principals = principalManager.getPrincipals(searchType);
                }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    protected Set<Principal> getPrincipals() {
        // use linked HashSet instead of HashSet in order to maintain the order
        // of principals (as in the Subject).
        Set<Principal> principals = new LinkedHashSet<Principal>();
        principals.add(principal);
        PrincipalIterator groups = principalProvider.getGroupMembership(principal);
        while (groups.hasNext()) {
            principals.add(groups.nextPrincipal());
        }
        return principals;
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

        if (!(superuser instanceof JackrabbitSession)) {
            throw new NotExecutableException();
        }

        PrincipalManager pMgr = ((JackrabbitSession) superuser).getPrincipalManager();
        PrincipalIterator it = pMgr.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
        if (it.hasNext()) {
            return it.nextPrincipal();
        } else {
            throw new NotExecutableException();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    }

    @Test
    public void testExistingPrincipal() throws Exception {
        Principal existing = null;
        PrincipalIterator principalIterator = ((JackrabbitSession) adminSession).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_ALL);
        while (principalIterator.hasNext()) {
            Principal p = principalIterator.nextPrincipal();
            if (userMgr.getAuthorizable(p) != null) {
                existing = p;
                break;
            }
        }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

                return new PrincipalIteratorAdapter(Collections.singletonList(p));
            }
        }

        public PrincipalIterator getPrincipals(int searchType) {
            PrincipalIterator it;
            switch (searchType) {
                case PrincipalManager.SEARCH_TYPE_GROUP:
                    it = new PrincipalIteratorAdapter(Collections.singletonList(EveryonePrincipal.getInstance()));
                    break;
                case PrincipalManager.SEARCH_TYPE_NOT_GROUP:
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    protected Set<Principal> getPrincipals() {
        // use linked HashSet instead of HashSet in order to maintain the order
        // of principals (as in the Subject).
        Set<Principal> principals = new LinkedHashSet<Principal>();
        principals.add(principal);
        PrincipalIterator groups = principalProvider.getGroupMembership(principal);
        while (groups.hasNext()) {
            principals.add(groups.nextPrincipal());
        }
        return principals;
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    }

    @Override
    public Principal getKnownPrincipal(Session session) throws RepositoryException {
        if (session instanceof JackrabbitSession) {
            PrincipalIterator principals = ((JackrabbitSession) session).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
            if (principals.hasNext()) {
                return principals.nextPrincipal();
            }
        }

        throw new UnsupportedRepositoryOperationException();
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    }

    @Override
    public Principal getKnownPrincipal(Session session) throws RepositoryException {
        if (session instanceof JackrabbitSession) {
            PrincipalIterator principals = ((JackrabbitSession) session).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
            if (principals.hasNext()) {
                return principals.nextPrincipal();
            }
        }

        throw new UnsupportedRepositoryOperationException();
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

    // TODO: add tests for 'findPrincipals'

    public void testUnknownUserMemberShip() throws RepositoryException {
        Principal userPrincipal = getTestPrincipal();

        PrincipalIterator pit = principalProvider.getGroupMembership(userPrincipal);

        // unknown user must be in 'everyone' group but nothing else
        assertTrue(pit.hasNext());
        assertEquals(EveryonePrincipal.getInstance(), pit.nextPrincipal());
        assertFalse(pit.hasNext());
    }
View Full Code Here

Examples of org.apache.jackrabbit.api.security.principal.PrincipalIterator

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

            PrincipalIterator it = principalProvider.getGroupMembership(u.getPrincipal());
            while (it.hasNext()) {
                Principal p = it.nextPrincipal();
                if (p.equals(gr1.getPrincipal())) {
                    // success return
                    return;
                }
            }
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.