Add policies to write context

graph-rework-2
noah metz 2023-07-24 20:45:07 -06:00
parent 6a2ed50578
commit f118dde221
1 changed files with 1 additions and 1 deletions

@ -225,7 +225,7 @@ func Signal(context *StateContext, node Node, princ Node, signal GraphSignal) er
func AttachPolicies(ctx *Context, node Node, policies ...Policy) error { func AttachPolicies(ctx *Context, node Node, policies ...Policy) error {
context := NewWriteContext(ctx) context := NewWriteContext(ctx)
return UpdateStates(context, node, NewLockInfo(node, []string{"policies"}), func(context *StateContext) error { return UpdateStates(context, node, NewLockMap(NewLockInfo(node, []string{"policies"}), LockList(policies, nil)), func(context *StateContext) error {
for _, policy := range(policies) { for _, policy := range(policies) {
node.NodeHandle().PolicyMap[policy.ID()] = policy node.NodeHandle().PolicyMap[policy.ID()] = policy
} }