light modification

This commit is contained in:
mr 2025-01-22 11:16:35 +01:00
parent 287aa3dea3
commit 2a93b17d71

View File

@ -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) {