Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Add node rule ACL support (fix #49) #51

Merged
merged 2 commits into from
Oct 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type rulePath struct {
}

type aclRule struct {
Node map[string]*rulePath `json:"node,omitempty"`
Key map[string]*rulePath `json:"key,omitempty"`
Service map[string]*rulePath `json:"service,omitempty"`
Event map[string]*rulePath `json:"event,omitempty"`
Expand Down Expand Up @@ -45,6 +46,7 @@ func getRulesString(rs []string) (string, error) {
}

rules := &aclRule{
Node: make(map[string]*rulePath),
Key: make(map[string]*rulePath),
Service: make(map[string]*rulePath),
Event: make(map[string]*rulePath),
Expand All @@ -64,6 +66,8 @@ func getRulesString(rs []string) (string, error) {
rules.Keyring = getPolicy(parts, 1)
case "key":
rules.Key[getPath(parts, 1)] = &rulePath{Policy: getPolicy(parts, 2)}
case "node":
rules.Node[getPath(parts, 1)] = &rulePath{Policy: getPolicy(parts, 2)}
case "service":
rules.Service[getPath(parts, 1)] = &rulePath{Policy: getPolicy(parts, 2)}
case "event":
Expand Down