use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipExternalUser2.
@Test
public void testGetGroupMembershipExternalUser2() throws Exception {
Authorizable user = getUserManager(root).getAuthorizable(USER_ID);
assertNotNull(user);
Set<Principal> expected = getExpectedGroupPrincipals(USER_ID);
// same as in test before even if the principal is not a tree-based-principal
Set<? extends Principal> principals = principalProvider.getGroupMembership(new PrincipalImpl(user.getPrincipal().getName()));
assertEquals(expected, principals);
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipExternalGroup.
@Test
public void testGetGroupMembershipExternalGroup() throws Exception {
Authorizable group = getUserManager(root).getAuthorizable("secondGroup");
assertNotNull(group);
Set<? extends Principal> principals = principalProvider.getGroupMembership(group.getPrincipal());
assertTrue(principals.isEmpty());
// same if the principal is not marked as 'java.security.acl.Group' and not tree-based-principal
principals = principalProvider.getGroupMembership(new PrincipalImpl(group.getPrincipal().getName()));
assertTrue(principals.isEmpty());
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipDefaultSync.
@Test
public void testGetGroupMembershipDefaultSync() throws Exception {
// synchronized by default sync-context => no 'dynamic' group principals
Authorizable user = getUserManager(root).getAuthorizable(TestIdentityProvider.ID_SECOND_USER);
assertNotNull(user);
Set<? extends Principal> principals = principalProvider.getGroupMembership(user.getPrincipal());
assertTrue(principals.isEmpty());
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class ExternalGroupPrincipalProviderTest method testGetGroupMembershipDefaultSync2.
@Test
public void testGetGroupMembershipDefaultSync2() throws Exception {
// synchronized by default sync-context => no 'dynamic' group principals
Authorizable user = getUserManager(root).getAuthorizable(TestIdentityProvider.ID_SECOND_USER);
assertNotNull(user);
// same as in test before even if the principal is not a tree-based-principal
Set<? extends Principal> principals = principalProvider.getGroupMembership(new PrincipalImpl(user.getPrincipal().getName()));
assertTrue(principals.isEmpty());
}
use of org.apache.jackrabbit.api.security.user.Authorizable in project jackrabbit-oak by apache.
the class UserQueryManager method findAuthorizables.
@Nonnull
private Iterator<Authorizable> findAuthorizables(@Nonnull String statement, long limit, long offset, @Nullable AuthorizableType type) throws RepositoryException {
try {
Result query = root.getQueryEngine().executeQuery(statement, javax.jcr.query.Query.XPATH, limit, offset, NO_BINDINGS, namePathMapper.getSessionLocalMappings());
Iterable<? extends ResultRow> resultRows = query.getRows();
Iterator<Authorizable> authorizables = Iterators.transform(resultRows.iterator(), new ResultRowToAuthorizable(userManager, root, type));
return Iterators.filter(authorizables, new UniqueResultPredicate());
} catch (ParseException e) {
log.warn("Invalid user query: " + statement, e);
throw new RepositoryException(e);
}
}
Aggregations