light modification
This commit is contained in:
parent
de585a7234
commit
0d83885b9b
@ -1,6 +1,8 @@
|
||||
package resources
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
@ -28,6 +30,7 @@ func (r *ResourceSet) Clear() {
|
||||
}
|
||||
|
||||
func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
||||
r.Clear()
|
||||
for k, v := range map[utils.DBObject][]string{
|
||||
(&DataResource{}): r.Datas,
|
||||
(&ComputeResource{}): r.Computes,
|
||||
@ -35,6 +38,7 @@ func (r *ResourceSet) Fill(request *tools.APIRequest) {
|
||||
(&ProcessingResource{}): r.Processings,
|
||||
(&WorkflowResource{}): r.Workflows,
|
||||
} {
|
||||
fmt.Println(len(v), k)
|
||||
for _, id := range v {
|
||||
d, _, e := k.GetAccessor(request).LoadOne(id)
|
||||
if e == nil {
|
||||
|
@ -144,7 +144,6 @@ func GenericSearch[T DBObject](filters *dbs.Filters, search string, defaultFilte
|
||||
if filters == nil && search != "" {
|
||||
filters = defaultFilters
|
||||
}
|
||||
fmt.Println("filters", filters, wfa.GetType().String(), search)
|
||||
res_mongo, code, err := mongo.MONGOService.Search(filters, wfa.GetType().String())
|
||||
return genericLoadAll[T](res_mongo, code, err, onlyDraft, f, wfa)
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package workspace
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
@ -23,15 +21,12 @@ func (d *Workspace) GetAccessor(request *tools.APIRequest) utils.Accessor {
|
||||
}
|
||||
|
||||
func (ao *Workspace) VerifyAuth(request *tools.APIRequest) bool {
|
||||
fmt.Println("Workspace.VerifyAuth", ao.Shared)
|
||||
if ao.Shared != "" {
|
||||
shared, code, _ := shallow_collaborative_area.NewAccessor(request).LoadOne(ao.Shared)
|
||||
fmt.Println("Workspace.VerifyAuth", shared, code)
|
||||
if code != 200 || shared == nil {
|
||||
return false
|
||||
}
|
||||
return shared.VerifyAuth(request)
|
||||
}
|
||||
fmt.Println("Workspace.VerifyAuth", ao.AbstractObject.VerifyAuth(request))
|
||||
return ao.AbstractObject.VerifyAuth(request)
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func (a *workspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject,
|
||||
}
|
||||
res, _, err := a.Search(filters, "", true) // Search for the workspace
|
||||
if err == nil && len(res) > 0 { // If the workspace already exists, return an error
|
||||
return nil, 409, errors.New("A workspace with the same name already exists")
|
||||
return nil, 409, errors.New("a workspace with the same name already exists")
|
||||
}
|
||||
// reset the resources
|
||||
d := data.(*Workspace)
|
||||
|
Loading…
Reference in New Issue
Block a user