From 3bc427f2a9b0e381305ccb5cdabb7c201288eda3 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 31 Jul 2023 19:16:23 -0600 Subject: [PATCH] Added default node policy that allows any node to send a response. --- policy.go | 7 ++++++- signal.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/policy.go b/policy.go index ebf88ae..e2cacfc 100644 --- a/policy.go +++ b/policy.go @@ -326,9 +326,14 @@ func (ext *ACLExt) Field(name string) interface{} { }) } +var ErrorSignalAction = Action{"ERROR_RESP"} +var DefaultACLPolicies = []Policy{ + NewAllNodesPolicy(Actions{ErrorSignalAction}), +} + func NewACLExt(policies ...Policy) *ACLExt { policy_map := map[PolicyType]Policy{} - for _, policy := range(policies) { + for _, policy := range(append(policies, DefaultACLPolicies...)) { existing, exists := policy_map[policy.Type()] if exists == true { policy = existing.Merge(policy) diff --git a/signal.go b/signal.go index 5ec96d2..d82f2c4 100644 --- a/signal.go +++ b/signal.go @@ -148,6 +148,10 @@ type ErrorSignal struct { Error error `json:"error"` } +func (signal ErrorSignal) Permission() Action { + return ErrorSignalAction +} + func NewErrorSignal(req_id uuid.UUID, err error) ErrorSignal { return ErrorSignal{ BaseSignal: BaseSignal{