peer is a public data

This commit is contained in:
mr 2025-02-04 14:43:21 +01:00
parent 3061df4f13
commit 69bf951866

View File

@ -102,13 +102,10 @@ func filterEnrich[T utils.ShallowDBObject](arr []string, isDrafted bool, a utils
// enrich is a function that enriches the CollaborativeArea with the shared objects // enrich is a function that enriches the CollaborativeArea with the shared objects
func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeArea, isDrafted bool, request *tools.APIRequest) *CollaborativeArea { func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeArea, isDrafted bool, request *tools.APIRequest) *CollaborativeArea {
sharedWorkspace.SharedWorkspaces = append(sharedWorkspace.SharedWorkspaces, sharedWorkspace.SharedWorkspaces = filterEnrich[*workspace.Workspace](sharedWorkspace.Workspaces, isDrafted, a.workspaceAccessor)
filterEnrich[*workspace.Workspace](sharedWorkspace.Workspaces, isDrafted, a.workspaceAccessor)...) sharedWorkspace.SharedWorkflows = filterEnrich[*workflow.Workflow](sharedWorkspace.Workflows, isDrafted, a.workflowAccessor)
sharedWorkspace.SharedWorkflows = append(sharedWorkspace.SharedWorkflows,
filterEnrich[*workflow.Workflow](sharedWorkspace.Workflows, isDrafted, a.workflowAccessor)...)
peerskey := []string{} peerskey := []string{}
fmt.Println("PEERS 1", sharedWorkspace.AllowedPeersGroup) fmt.Println("PEERS 1", sharedWorkspace.AllowedPeersGroup)
for k, v := range sharedWorkspace.AllowedPeersGroup { for k, v := range sharedWorkspace.AllowedPeersGroup {
canFound := false canFound := false
for _, t := range request.Groups { for _, t := range request.Groups {
@ -123,10 +120,8 @@ func (a *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeAr
} }
} }
fmt.Println("PEERS", peerskey) fmt.Println("PEERS", peerskey)
sharedWorkspace.SharedPeers = append(sharedWorkspace.SharedPeers, sharedWorkspace.SharedPeers = filterEnrich[*peer.Peer](peerskey, isDrafted, a.peerAccessor)
filterEnrich[*peer.Peer](peerskey, isDrafted, a.peerAccessor)...) sharedWorkspace.SharedRules = filterEnrich[*rule.Rule](sharedWorkspace.Rules, isDrafted, a.ruleAccessor)
sharedWorkspace.SharedRules = append(sharedWorkspace.SharedRules,
filterEnrich[*rule.Rule](sharedWorkspace.Rules, isDrafted, a.ruleAccessor)...)
return sharedWorkspace return sharedWorkspace
} }