Added default node policy that allows any node to send a response.

gql_cataclysm
noah metz 2023-07-31 19:16:23 -06:00
parent 6895aa7c8e
commit 3bc427f2a9
2 changed files with 10 additions and 1 deletions

@ -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 { func NewACLExt(policies ...Policy) *ACLExt {
policy_map := map[PolicyType]Policy{} policy_map := map[PolicyType]Policy{}
for _, policy := range(policies) { for _, policy := range(append(policies, DefaultACLPolicies...)) {
existing, exists := policy_map[policy.Type()] existing, exists := policy_map[policy.Type()]
if exists == true { if exists == true {
policy = existing.Merge(policy) policy = existing.Merge(policy)

@ -148,6 +148,10 @@ type ErrorSignal struct {
Error error `json:"error"` Error error `json:"error"`
} }
func (signal ErrorSignal) Permission() Action {
return ErrorSignalAction
}
func NewErrorSignal(req_id uuid.UUID, err error) ErrorSignal { func NewErrorSignal(req_id uuid.UUID, err error) ErrorSignal {
return ErrorSignal{ return ErrorSignal{
BaseSignal: BaseSignal{ BaseSignal: BaseSignal{