use of com.enonic.xp.security.UserQueryResult in project xp by enonic.
the class FindUsersHandlerTest method testExamples.
@Test
public void testExamples() {
final UserQueryResult result = UserQueryResult.create().addUser(TestDataFixtures.getTestUser()).totalSize(1).build();
Mockito.when(securityService.query(Mockito.any(UserQuery.class))).thenReturn(result);
runScript("/lib/xp/examples/auth/findUsers.js");
}
use of com.enonic.xp.security.UserQueryResult in project xp by enonic.
the class FindUsersHandler method execute.
public PrincipalsResultMapper execute() {
final ConstraintExpr constraintExpr = QueryParser.parseCostraintExpression(this.query == null ? "" : this.query);
final List<OrderExpr> orderExpressions = QueryParser.parseOrderExpressions(this.sort == null ? "" : this.sort);
final QueryExpr queryExpr = QueryExpr.from(constraintExpr, orderExpressions);
final UserQuery userQuery = UserQuery.create().from(this.start).size(this.count).queryExpr(queryExpr).build();
final UserQueryResult result = this.securityService.get().query(userQuery);
return new PrincipalsResultMapper(result.getUsers(), result.getTotalSize(), this.includeProfile);
}
Aggregations