From 51e2dcc404090f8eb8ecac9e6a4db1126b780127 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 22 Apr 2026 11:47:08 +0200 Subject: [PATCH] Load One pb --- models/utils/common.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/models/utils/common.go b/models/utils/common.go index 46674ee..6cf36c3 100755 --- a/models/utils/common.go +++ b/models/utils/common.go @@ -162,9 +162,6 @@ func GenericUpdateOne(change map[string]interface{}, id string, a Accessor) (DBO } func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, int, error), a Accessor) (DBObject, int, error) { - if a.ShouldVerifyAuth() && !data.VerifyAuth("get", a.GetRequest()) { - return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String()) - } res_mongo, code, err := mongo.MONGOService.LoadOne(id, a.GetType().String()) if err != nil { return nil, code, err @@ -172,7 +169,9 @@ func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, i if err = res_mongo.Decode(data); err != nil { return nil, 400, err } - + if a.ShouldVerifyAuth() && !data.VerifyAuth("get", a.GetRequest()) { + return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String()) + } return f(data) }