mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-27 02:38:06 -04:00
@@ -44,13 +44,13 @@ func recursiveBuildQuery(n *godata.ParseNode) (query.Query, error) {
|
||||
switch n.Token.Value {
|
||||
case "eq":
|
||||
if len(n.Children) != 2 {
|
||||
return nil, errors.New("Equality match must have two children")
|
||||
return nil, errors.New("equality match must have two children")
|
||||
}
|
||||
if n.Children[0].Token.Type != godata.FilterTokenLiteral {
|
||||
return nil, errors.New("Equality expected a literal on the lhs")
|
||||
return nil, errors.New("equality expected a literal on the lhs")
|
||||
}
|
||||
if n.Children[1].Token.Type != godata.FilterTokenString {
|
||||
return nil, errors.New("Equality expected a string on the rhs")
|
||||
return nil, errors.New("equality expected a string on the rhs")
|
||||
}
|
||||
q := bleve.NewTermQuery(n.Children[1].Token.Value)
|
||||
q.SetField(n.Children[0].Token.Value)
|
||||
@@ -81,7 +81,7 @@ func recursiveBuildQuery(n *godata.ParseNode) (query.Query, error) {
|
||||
return q, nil
|
||||
case "Not":
|
||||
if len(n.Children) != 1 {
|
||||
return nil, errors.New("Not filter must have only one child")
|
||||
return nil, errors.New("not filter must have only one child")
|
||||
}
|
||||
subQuery, err := recursiveBuildQuery(n.Children[0])
|
||||
if err != nil {
|
||||
|
||||
@@ -137,6 +137,11 @@ func (s Service) ListAccounts(ctx context.Context, in *proto.ListAccountsRequest
|
||||
searchRequest := bleve.NewSearchRequest(query)
|
||||
var searchResult *bleve.SearchResult
|
||||
searchResult, err = s.index.Search(searchRequest)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("could not execute bleve search")
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug().Interface("result", searchResult).Msg("result")
|
||||
|
||||
res.Accounts = make([]*proto.Account, 0)
|
||||
@@ -243,7 +248,10 @@ func (s Service) CreateAccount(c context.Context, req *proto.CreateAccountReques
|
||||
}
|
||||
|
||||
var bytes []byte
|
||||
bytes, err = json.Marshal(req.GetAccount)
|
||||
if bytes, err = json.Marshal(req.Account); err != nil {
|
||||
log.Error().Err(err).Interface("account", req.Account).Msg("could not marshal account")
|
||||
return
|
||||
}
|
||||
if err = ioutil.WriteFile(path, bytes, 0600); err != nil {
|
||||
req.Account.PasswordProfile.Password = "***REMOVED***"
|
||||
log.Error().Err(err).Str("id", id).Str("path", path).Interface("account", req.Account).Msg("could not persist new account")
|
||||
|
||||
Reference in New Issue
Block a user