From 599a6144803eea2c419bde1c6d397a7f0616847d Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 2 Dec 2024 16:59:08 +0100 Subject: [PATCH] test --- models/collaborative_area/collaborative_area.go | 2 ++ models/utils/abstracts.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/models/collaborative_area/collaborative_area.go b/models/collaborative_area/collaborative_area.go index 2344d72..b08716d 100644 --- a/models/collaborative_area/collaborative_area.go +++ b/models/collaborative_area/collaborative_area.go @@ -1,6 +1,7 @@ package collaborative_area import ( + "fmt" "slices" "time" @@ -72,6 +73,7 @@ func (ao *CollaborativeArea) Clear(peerID string) { func (ao *CollaborativeArea) VerifyAuth(peerID string, groups []string) bool { if ao.AllowedPeersGroup != nil || config.GetConfig().Whitelist { if grps, ok := ao.AllowedPeersGroup[peerID]; ok || config.GetConfig().Whitelist { + fmt.Println("grps", grps, "ok", ok, "config.GetConfig().Whitelist", config.GetConfig().Whitelist) if slices.Contains(grps, "*") || (!ok && config.GetConfig().Whitelist) { return true } diff --git a/models/utils/abstracts.go b/models/utils/abstracts.go index 3ec405c..23e45b1 100644 --- a/models/utils/abstracts.go +++ b/models/utils/abstracts.go @@ -213,10 +213,10 @@ func genericLoadAll[T DBObject](res *mgb.Cursor, code int, err error, f func(DBO return nil, 404, err } for _, r := range results { + fmt.Println("results", r.VerifyAuth(a.GetPeerID(), a.GetGroups())) if !r.VerifyAuth(a.GetPeerID(), a.GetGroups()) { continue } - fmt.Println("results", len(results), f(r)) objs = append(objs, f(r)) } return objs, 200, nil @@ -224,6 +224,7 @@ func genericLoadAll[T DBObject](res *mgb.Cursor, code int, err error, f func(DBO func GenericLoadAll[T DBObject](f func(DBObject) ShallowDBObject, wfa Accessor) ([]ShallowDBObject, int, error) { res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType().String()) + fmt.Println("res_mongo", res_mongo) return genericLoadAll[T](res_mongo, code, err, f, wfa) }