adjust allowed instances for type behaviors
This commit is contained in:
@@ -20,9 +20,9 @@ import (
|
||||
*/
|
||||
type DynamicResource struct {
|
||||
AbstractResource
|
||||
Type tools.DataType `bson:"type,omitempty" json:"type,omitempty"`
|
||||
Filters map[string]interface{} `bson:"filters,omitempty" json:"filters,omitempty"`
|
||||
SortRules map[string]string `bson:"rules,omitempty" json:"rules,omitempty"`
|
||||
Type tools.DataType `bson:"type,omitempty" json:"type,omitempty"`
|
||||
Filters dbs.Filters `bson:"filters,omitempty" json:"filters,omitempty"`
|
||||
SortRules map[string]string `bson:"rules,omitempty" json:"rules,omitempty"`
|
||||
|
||||
PeerIds map[int]string `bson:"peer_ids,omitempty" json:"peer_ids,omitempty"`
|
||||
ResourceIds map[int]string `bson:"resource_ids,omitempty" json:"resource_ids,omitempty"`
|
||||
@@ -53,8 +53,11 @@ func (d *DynamicResource) SetAllowedInstances(request *tools.APIRequest, instanc
|
||||
continue
|
||||
}
|
||||
access := NewAccessor[*DynamicResource](k, request)
|
||||
a, _, _ := access.Search(dbs.FiltersFromFlatMap(d.Filters, v), "", false, 0, 100000)
|
||||
fmt.Println(a, dbs.FiltersFromFlatMap(d.Filters, v), d.Filters, v)
|
||||
m := map[string]interface{}{}
|
||||
b, _ := json.Marshal(d.Filters)
|
||||
json.Unmarshal(b, &m)
|
||||
a, _, _ := access.Search(dbs.FiltersFromFlatMap(m, v), "", false, 0, 100000)
|
||||
fmt.Println(a, dbs.FiltersFromFlatMap(m, v), d.Filters, v)
|
||||
d.PeerIds = map[int]string{}
|
||||
d.ResourceIds = map[int]string{}
|
||||
for _, res := range a {
|
||||
|
||||
Reference in New Issue
Block a user