light modification
This commit is contained in:
parent
2452d37acf
commit
58b36f2823
@ -81,11 +81,11 @@ func (abs *AbstractIntanciatedResource[T]) ConvertToPricedResource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (abs *AbstractIntanciatedResource[T]) SetAllowedInstances(request *tools.APIRequest) {
|
func (abs *AbstractIntanciatedResource[T]) SetAllowedInstances(request *tools.APIRequest) {
|
||||||
abs.AbstractResource.AbstractObject.Type = abs.GetType()
|
|
||||||
abs.Instances = verifyAuthAction[T](abs.Instances, request)
|
abs.Instances = verifyAuthAction[T](abs.Instances, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *AbstractIntanciatedResource[T]) Trim() {
|
func (d *AbstractIntanciatedResource[T]) Trim() {
|
||||||
|
d.AbstractResource.AbstractObject.Type = d.GetType()
|
||||||
if ok, _ := (&peer.Peer{AbstractObject: utils.AbstractObject{UUID: d.CreatorID}}).IsMySelf(); !ok {
|
if ok, _ := (&peer.Peer{AbstractObject: utils.AbstractObject{UUID: d.CreatorID}}).IsMySelf(); !ok {
|
||||||
for _, instance := range d.Instances {
|
for _, instance := range d.Instances {
|
||||||
instance.ClearPeerGroups()
|
instance.ClearPeerGroups()
|
||||||
|
@ -96,6 +96,7 @@ func (abs *resourceMongoAccessor[T]) getResourceFilter(search string) *dbs.Filte
|
|||||||
return &dbs.Filters{
|
return &dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{ // filter by like name, short_description, description, owner, url if no filters are provided
|
Or: map[string][]dbs.Filter{ // filter by like name, short_description, description, owner, url if no filters are provided
|
||||||
"abstractintanciatedresource.abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractintanciatedresource.abstractresource.abstractobject.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
|
"abstractintanciatedresource.abstractresource.abstractobject.type": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
"abstractintanciatedresource.abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractintanciatedresource.abstractresource.short_description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
"abstractintanciatedresource.abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractintanciatedresource.abstractresource.description": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
"abstractintanciatedresource.abstractresource.owners.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
"abstractintanciatedresource.abstractresource.owners.name": {{Operator: dbs.LIKE.String(), Value: search}},
|
||||||
|
@ -124,12 +124,10 @@ func genericLoadAll[T DBObject](res *mgb.Cursor, code int, err error, onlyDraft
|
|||||||
if err = res.All(mongo.MngoCtx, &results); err != nil {
|
if err = res.All(mongo.MngoCtx, &results); err != nil {
|
||||||
return nil, 404, err
|
return nil, 404, err
|
||||||
}
|
}
|
||||||
fmt.Println("results", results, res)
|
|
||||||
for _, r := range results {
|
for _, r := range results {
|
||||||
if !r.VerifyAuth(a.GetRequest()) || f(r) == nil || (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()) {
|
if !r.VerifyAuth(a.GetRequest()) || f(r) == nil || (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Println(!r.VerifyAuth(a.GetRequest()), f(r) == nil, (onlyDraft && !r.IsDrafted()) || (!onlyDraft && r.IsDrafted()), onlyDraft && !r.IsDrafted(), !onlyDraft && r.IsDrafted())
|
|
||||||
objs = append(objs, f(r))
|
objs = append(objs, f(r))
|
||||||
}
|
}
|
||||||
fmt.Println("results 2", results, objs)
|
fmt.Println("results 2", results, objs)
|
||||||
|
Loading…
Reference in New Issue
Block a user