Apply
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||
@@ -131,6 +132,7 @@ func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, i
|
||||
if err != nil {
|
||||
return nil, code, err
|
||||
}
|
||||
fmt.Println("APPLY", data)
|
||||
res_mongo.Decode(&data)
|
||||
if a.ShouldVerifyAuth() && !data.VerifyAuth("get", a.GetRequest()) {
|
||||
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
|
||||
@@ -187,7 +189,7 @@ func GetMySelf(wfa Accessor) (ShallowDBObject, error) {
|
||||
"relation": {{Operator: dbs.EQUAL.String(), Value: 1}},
|
||||
},
|
||||
}, "", false)
|
||||
if len(datas) > 0 {
|
||||
if len(datas) > 0 && datas[0] != nil {
|
||||
return datas[0], nil
|
||||
}
|
||||
return nil, errors.New("peer not found")
|
||||
|
||||
Reference in New Issue
Block a user