IsRelevantFor checks, whether this control is relevant for the given audit scope. For now this mainly checks, whether the assurance level matches, if the Audit Scope has one. In the future, this could also include checks, if the control is somehow out of scope.
(auditScope *AuditScope, catalog *Catalog)
| 167 | // checks, whether the assurance level matches, if the Audit Scope has one. In the future, this could also include checks, if |
| 168 | // the control is somehow out of scope. |
| 169 | func (c *Control) IsRelevantFor(auditScope *AuditScope, catalog *Catalog) bool { |
| 170 | // If the catalog does not have an assurance level, we are good to go |
| 171 | if len(catalog.AssuranceLevels) == 0 { |
| 172 | return true |
| 173 | } |
| 174 | |
| 175 | // If the control does not explicitly specify an assurance level, we are also ok |
| 176 | if c.AssuranceLevel == nil || auditScope.AssuranceLevel == nil { |
| 177 | return true |
| 178 | } |
| 179 | |
| 180 | // Otherwise, we need to retrieve the possible assurance levels (in order) from the catalogs and compare the |
| 181 | // indices |
| 182 | idxControl := slices.Index(catalog.AssuranceLevels, *c.AssuranceLevel) |
| 183 | idxToe := slices.Index(catalog.AssuranceLevels, *auditScope.AssuranceLevel) |
| 184 | |
| 185 | return idxControl <= idxToe |
| 186 | } |
no outgoing calls
no test coverage detected