1
0
mirror of https://github.com/strongdm/comply synced 2026-02-13 00:14:48 +00:00

Refactor "Controls" to "Criterion" so we can add the "Program Controls" model in next

This commit is contained in:
Craine Runton
2020-09-15 16:21:16 -05:00
parent 84e439e7cc
commit a66764470c
9 changed files with 88 additions and 111 deletions

View File

@@ -1,6 +1,6 @@
package model
type Control struct {
type Criterion struct {
Family string `yaml:"family"`
Name string `yaml:"name"`
Description string `yaml:"description"`
@@ -8,11 +8,11 @@ type Control struct {
type Framework struct {
Name string `yaml:"name"`
Controls map[string]Control `yaml:",inline"`
Criteria map[string]Criterion `yaml:",inline"`
}
// ControlsSatisfied determines the unique controls currently satisfied by all Narratives, Policies, and Procedures
func ControlsSatisfied(data *Data) map[string][]string {
// CriteriaSatisfied determines the unique criteria currently satisfied by all Narratives, Policies, and Procedures
func CriteriaSatisfied(data *Data) map[string][]string {
satisfied := make(map[string][]string)
appendSatisfaction := func(in map[string][]string, k string, v string) []string {
@@ -25,22 +25,22 @@ func ControlsSatisfied(data *Data) map[string][]string {
}
for _, n := range data.Narratives {
for _, controlKeys := range n.Satisfies {
for _, key := range controlKeys {
for _, criteriaKeys := range n.Satisfies {
for _, key := range criteriaKeys {
satisfied[key] = appendSatisfaction(satisfied, key, n.OutputFilename)
}
}
}
for _, n := range data.Policies {
for _, controlKeys := range n.Satisfies {
for _, key := range controlKeys {
for _, criteriaKeys := range n.Satisfies {
for _, key := range criteriaKeys {
satisfied[key] = appendSatisfaction(satisfied, key, n.OutputFilename)
}
}
}
for _, n := range data.Procedures {
for _, controlKeys := range n.Satisfies {
for _, key := range controlKeys {
for _, criteriaKeys := range n.Satisfies {
for _, key := range criteriaKeys {
satisfied[key] = appendSatisfaction(satisfied, key, n.OutputFilename)
}
}