Add query operator that matches groups that are visible to all users
Change-Id: I161d66f26ace58a8e0d6a6183853936336ed0d15 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -48,6 +48,10 @@ public class GroupPredicates {
|
||||
GroupQueryBuilder.FIELD_OWNER, owner);
|
||||
}
|
||||
|
||||
public static Predicate<AccountGroup> isVisibleToAll() {
|
||||
return new GroupPredicate(GroupField.IS_VISIBLE_TO_ALL, "1");
|
||||
}
|
||||
|
||||
static class GroupPredicate extends IndexPredicate<AccountGroup> {
|
||||
GroupPredicate(FieldDef<AccountGroup, ?> def, String value) {
|
||||
super(def, value);
|
||||
|
||||
@@ -75,6 +75,14 @@ public class GroupQueryBuilder extends QueryBuilder<AccountGroup> {
|
||||
return GroupPredicates.owner(owner);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<AccountGroup> is(String value) throws QueryParseException {
|
||||
if ("visibleToAll".equalsIgnoreCase(value)) {
|
||||
return GroupPredicates.isVisibleToAll();
|
||||
}
|
||||
throw error("Invalid query");
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<AccountGroup> limit(String query)
|
||||
throws QueryParseException {
|
||||
|
||||
Reference in New Issue
Block a user