Add policies to write context
parent
6a2ed50578
commit
f118dde221
2
node.go
2
node.go
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue