diff --git a/models/resources/resource.go b/models/resources/resource.go index 61556ea..7f17ddc 100644 --- a/models/resources/resource.go +++ b/models/resources/resource.go @@ -1,6 +1,7 @@ package resources import ( + "fmt" "slices" "cloud.o-forge.io/core/oc-lib/config" @@ -100,15 +101,20 @@ func (abs *AbstractIntanciatedResource[T]) VerifyAuth(request *tools.APIRequest) func verifyAuthAction[T ResourceInstanceITF](baseInstance []T, request *tools.APIRequest) []T { instances := []T{} + fmt.Println("baseInstance", baseInstance) for _, instance := range baseInstance { _, peerGroups := instance.GetPeerGroups() + fmt.Println("peerGroups", peerGroups, request) for _, peers := range peerGroups { if request == nil { continue } + fmt.Println("request.PeerID]", peers[request.PeerID]) if grps, ok := peers[request.PeerID]; ok || config.GetConfig().Whitelist { + fmt.Println("grps", grps, request.Groups) if (ok && slices.Contains(grps, "*")) || (!ok && config.GetConfig().Whitelist) { instances = append(instances, instance) + continue } for _, grp := range grps { if slices.Contains(request.Groups, grp) {