use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L3_EveryoneTest method testEveryoneIsMemberofEveryone.
public void testEveryoneIsMemberofEveryone() throws RepositoryException {
java.security.acl.Group everyone = (java.security.acl.Group) principalManager.getEveryone();
PrincipalIterator it = principalManager.getPrincipals(PrincipalManager.SEARCH_TYPE_ALL);
// EXERCISE: discuss the dynamic nature of the everyone group principal
while (it.hasNext()) {
Principal principal = it.nextPrincipal();
if (everyone.equals(principal)) {
assertFalse(everyone.isMember(principal));
} else {
assertTrue(everyone.isMember(principal));
}
}
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L4_PrincipalProviderTest method testCorrespondance.
@Test
public void testCorrespondance() {
boolean exists = principalManager.hasPrincipal(testPrincipalName);
Principal principal = principalManager.getPrincipal(testPrincipalName);
PrincipalIterator principalIterator = principalManager.findPrincipals(testPrincipalName, PrincipalManager.SEARCH_TYPE_ALL);
PrincipalIterator groups = principalManager.getGroupMembership(principal);
PrincipalIterator all = principalManager.getPrincipals(PrincipalManager.SEARCH_TYPE_ALL);
// EXERCISE: write the corresponding calls for the principal provider and verify the expected result
// EXERCISE: which methods have nor corresponding call in the other interface?
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L2_PrincipalManagerTest method testFindPrincipals.
public void testFindPrincipals() throws RepositoryException {
// EXERCISE: play with the search hint
String searchHint = testPrincipalName;
// EXERCISE: modify the type flag
int searchType = PrincipalManager.SEARCH_TYPE_ALL;
PrincipalIterator principalIterator = principalManager.findPrincipals(testPrincipalName, searchType);
// EXERCISE: what is the expected query result depending on the search hint and the type-flag?
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L13_SystemUserTest method testSystemUserPrincipal.
@Test
public void testSystemUserPrincipal() throws RepositoryException {
Authorizable authorizable = getUserManager(root).getAuthorizable(systemUser.getID());
// EXERCISE: what is the nature of the principal of the system user? Assert your expectedation.
Principal principal = authorizable.getPrincipal();
PrincipalManager principalManager = getPrincipalManager(root);
PrincipalIterator pIter = principalManager.getGroupMembership(principal);
// EXERCISE
int expectedSize = -1;
assertEquals(expectedSize, pIter.getSize());
// EXERCISE
List<Principal> expectedGroupPrincipals = null;
while (pIter.hasNext()) {
Principal group = pIter.nextPrincipal();
assertTrue(expectedGroupPrincipals.remove(group));
}
assertTrue(expectedGroupPrincipals.isEmpty());
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class ImpersonationImplTest method testGetImpersonators.
@Test
public void testGetImpersonators() throws Exception {
PrincipalIterator it = impersonation.getImpersonators();
assertTrue(it.hasNext());
assertTrue(Iterators.contains(it, impersonator.getPrincipal()));
}
Aggregations