Add startswith(id,...) query for group
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/storage"
|
"github.com/owncloud/ocis/accounts/pkg/storage"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/gofrs/uuid"
|
"github.com/gofrs/uuid"
|
||||||
"github.com/golang/protobuf/ptypes/empty"
|
"github.com/golang/protobuf/ptypes/empty"
|
||||||
@@ -59,6 +60,12 @@ func (s Service) ListGroups(c context.Context, in *proto.ListGroupsRequest, out
|
|||||||
searchResults, _ = s.index.FindByPartial(&proto.Group{}, "DisplayName", "*")
|
searchResults, _ = s.index.FindByPartial(&proto.Group{}, "DisplayName", "*")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var startsWithIDQuery = regexp.MustCompile(`^startswith\(id,'(.*)'\)$`)
|
||||||
|
match := startsWithIDQuery.FindStringSubmatch(in.Query)
|
||||||
|
if len(match) == 2 {
|
||||||
|
searchResults = []string{match[1]}
|
||||||
|
}
|
||||||
|
|
||||||
for _, hit := range searchResults {
|
for _, hit := range searchResults {
|
||||||
g := &proto.Group{}
|
g := &proto.Group{}
|
||||||
if err = s.repo.LoadGroup(c, hit, g); err != nil {
|
if err = s.repo.LoadGroup(c, hit, g); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user