Examples of grantImpersonation()


Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

                        if (!imp.revokeImpersonation(princ)) {
                            handleFailure("Failed to revoke impersonation for " + princ.getName() + " on " + a);
                        }
                    }
                    for (Principal princ : toAdd) {
                        if (!imp.grantImpersonation(princ)) {
                            handleFailure("Failed to grant impersonation for " + princ.getName() + " on " + a);
                        }
                    }
                    // NOTE: no best effort handling so far. (TODO)
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

                        if (!imp.revokeImpersonation(princ)) {
                            handleFailure("Failed to revoke impersonation for " + princ.getName() + " on " + a);
                        }
                    }
                    for (Principal princ : toAdd) {
                        if (!imp.grantImpersonation(princ)) {
                            handleFailure("Failed to grant impersonation for " + princ.getName() + " on " + a);
                        }
                    }
                    // NOTE: no best effort handling so far. (TODO)
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        User child = (User) umgr.getAuthorizable(getYetAnotherID());
        Impersonation impers = child.getImpersonation();
        assertFalse(impers.allows(buildSubject(selfPrinc)));
        try {
            assertFalse(impers.grantImpersonation(selfPrinc));
            save(uSession);
        } catch (AccessDeniedException e) {
            // ok.
        }
        assertFalse(impers.allows(buildSubject(selfPrinc)));
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        User parent = (User) umgr.getAuthorizable(otherUID);
        impers = parent.getImpersonation();
        assertFalse(impers.allows(buildSubject(selfPrinc)));
        try {
            assertFalse(impers.grantImpersonation(selfPrinc));
            save(uSession);
        } catch (AccessDeniedException e) {
            // ok.
        }
        assertFalse(impers.allows(buildSubject(selfPrinc)));
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

            Authorizable a = uMgr.getAuthorizable(user2ID);

            Impersonation impers = ((User) a).getImpersonation();
            Principal himselfP = uMgr.getAuthorizable(uID).getPrincipal();
            assertFalse(impers.allows(buildSubject(himselfP)));
            impers.grantImpersonation(himselfP);
            save(uSession);

            fail("A non-administrator user should not be allowed modify Impersonation of another user.");
        } catch (AccessDeniedException e) {
            // success
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        Principal otherP = uMgr.getAuthorizable(otherUID).getPrincipal();

        Impersonation impers = u.getImpersonation();
        assertFalse(impers.allows(buildSubject(otherP)));

        assertTrue(impers.grantImpersonation(otherP));
        save(uSession);

        assertTrue(impers.allows(buildSubject(otherP)));

        assertTrue(impers.revokeImpersonation(otherP));
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        // admin cannot be add/remove to set of impersonators of 'u' but is
        // always allowed to impersonate that user.
        User u = (User) userMgr.getAuthorizable(uID);
        Impersonation impersonation = u.getImpersonation();

        assertFalse(impersonation.grantImpersonation(adminPrincipal));
        assertFalse(impersonation.revokeImpersonation(adminPrincipal));
        assertTrue(impersonation.allows(buildSubject(adminPrincipal)));

        // same if the impersonation object of the admin itself is used.
        Impersonation adminImpersonation = ((User) a).getImpersonation();
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        assertTrue(impersonation.allows(buildSubject(adminPrincipal)));

        // same if the impersonation object of the admin itself is used.
        Impersonation adminImpersonation = ((User) a).getImpersonation();

        assertFalse(adminImpersonation.grantImpersonation(adminPrincipal));
        assertFalse(adminImpersonation.revokeImpersonation(adminPrincipal));
        assertTrue(impersonation.allows(buildSubject(adminPrincipal)));
    }

    public void testSystemPrincipalAsImpersonator() throws RepositoryException {
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

        // system cannot be add/remove to set of impersonators of 'u' nor
        // should it be allowed to impersonate a given user...
        User u = (User) userMgr.getAuthorizable(uID);
        Impersonation impersonation = u.getImpersonation();

        assertFalse(impersonation.grantImpersonation(systemPrincipal));
        assertFalse(impersonation.revokeImpersonation(systemPrincipal));
        assertFalse(impersonation.allows(buildSubject(systemPrincipal)));
    }
}
View Full Code Here

Examples of org.apache.jackrabbit.api.security.user.Impersonation.grantImpersonation()

            save(otherSession);

            Impersonation impers = u.getImpersonation();
            assertFalse(impers.allows(buildSubject(otherP)));

            assertTrue(impers.grantImpersonation(otherP));
            save(otherSession);

            assertTrue(impers.allows(buildSubject(otherP)));
        } finally {
            // impersonation get removed while removing the user u.
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.