Skip to content

Commit

Permalink
perform acl operations on cloned map
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Nov 4, 2024
1 parent 2d3d5fe commit e36eef4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions logic/acls/nodeacls/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nodeacls
import (
"encoding/json"
"fmt"
"maps"
"sync"

"github.com/gravitl/netmaker/logic/acls"
Expand All @@ -20,8 +21,9 @@ func AreNodesAllowed(networkID NetworkID, node1, node2 NodeID) bool {
}
var allowed bool
acls.AclMutex.Lock()
currNetworkACLNode1 := currentNetworkACL[acls.AclID(node1)]
currNetworkACLNode2 := currentNetworkACL[acls.AclID(node2)]
currNetAclCopy := maps.Clone(currentNetworkACL)
currNetworkACLNode1 := currNetAclCopy[acls.AclID(node1)]
currNetworkACLNode2 := currNetAclCopy[acls.AclID(node2)]
acls.AclMutex.Unlock()
allowed = currNetworkACLNode1.IsAllowed(acls.AclID(node2)) && currNetworkACLNode2.IsAllowed(acls.AclID(node1))
return allowed
Expand Down

0 comments on commit e36eef4

Please sign in to comment.