use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class PrincipalManagerImplTest method testGetPrincipalsNonGroupContainsNoGroups.
@Test
public void testGetPrincipalsNonGroupContainsNoGroups() {
PrincipalIterator it = principalMgr.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
while (it.hasNext()) {
Principal p = it.nextPrincipal();
assertFalse(isGroup(p));
}
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class PrincipalManagerImplTest method testFindEveryoneTypeNonGroup.
@Test
public void testFindEveryoneTypeNonGroup() {
// search non-group only -> everyone should not be part of the result set
PrincipalIterator it = principalMgr.findPrincipals(EveryonePrincipal.NAME, PrincipalManager.SEARCH_TYPE_NOT_GROUP);
assertFalse("findPrincipals did find principal with filter '" + EveryonePrincipal.NAME + '\'', Iterators.contains(it, EveryonePrincipal.getInstance()));
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L2_PrincipalManagerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
principalManager = ((JackrabbitSession) superuser).getPrincipalManager();
// NOTE: this method call doesn't make to much sense outside of a
// simple test with a very limited number of principals (!!)
PrincipalIterator principalIterator = principalManager.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
if (principalIterator.hasNext()) {
testPrincipalName = principalIterator.nextPrincipal().getName();
}
if (testPrincipalName == null) {
throw new NotExecutableException();
}
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class L4_PrincipalProviderTest method before.
@Override
public void before() throws Exception {
super.before();
principalProvider = getConfig(PrincipalConfiguration.class).getPrincipalProvider(root, NamePathMapper.DEFAULT);
principalManager = getConfig(PrincipalConfiguration.class).getPrincipalManager(root, NamePathMapper.DEFAULT);
// NOTE: this method call doesn't make to much sense outside of a
// simple test with a very limited number of principals (!!)
PrincipalIterator principalIterator = principalManager.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
if (principalIterator.hasNext()) {
testPrincipalName = principalIterator.nextPrincipal().getName();
}
if (testPrincipalName == null) {
throw new NotExecutableException();
}
}
use of org.apache.jackrabbit.api.security.principal.PrincipalIterator in project jackrabbit-oak by apache.
the class PrincipalManagerTest method testFindEveryone.
@Test
public void testFindEveryone() {
Principal everyone = principalMgr.getEveryone();
assertTrue(principalMgr.hasPrincipal(everyone.getName()));
boolean containedInResult = false;
// untyped search -> everyone must be part of the result set
PrincipalIterator it = principalMgr.findPrincipals(everyone.getName());
while (it.hasNext()) {
Principal p = it.nextPrincipal();
if (p.getName().equals(everyone.getName())) {
containedInResult = true;
}
}
assertTrue(containedInResult);
// search group only -> everyone must be part of the result set
containedInResult = false;
it = principalMgr.findPrincipals(everyone.getName(), PrincipalManager.SEARCH_TYPE_GROUP);
while (it.hasNext()) {
Principal p = it.nextPrincipal();
if (p.getName().equals(everyone.getName())) {
containedInResult = true;
}
}
assertTrue(containedInResult);
// search non-group only -> everyone should not be part of the result set
containedInResult = false;
it = principalMgr.findPrincipals(everyone.getName(), PrincipalManager.SEARCH_TYPE_NOT_GROUP);
while (it.hasNext()) {
Principal p = it.nextPrincipal();
if (p.getName().equals(everyone.getName())) {
containedInResult = true;
}
}
assertFalse(containedInResult);
}
Aggregations