test
This commit is contained in:
parent
e2ddd7e4e6
commit
599a614480
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user