|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
@ -629,73 +628,3 @@ SxTJANJHqf4BiFtVjN7LZXi3HUIRAsceEbd0TfW5be9SQ0tbDyyGYt/bXtBLGTIh
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAPI_RulesTranslate_Raw(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
c, s := makeACLClient(t)
|
|
|
|
|
defer s.Stop()
|
|
|
|
|
|
|
|
|
|
acl := c.ACL()
|
|
|
|
|
|
|
|
|
|
input := `#start of policy
|
|
|
|
|
agent "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
node "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
service "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
session "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
query "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
expected := `#start of policy
|
|
|
|
|
agent_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
node_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
service_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
session_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
query_prefix "" {
|
|
|
|
|
policy = "read"
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
|
|
rules, err := acl.RulesTranslate(strings.NewReader(input))
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
|
require.Equal(t, expected, rules)
|
|
|
|
|
}
|
|
|
|
|