erase repetitive frameworks

This commit is contained in:
Daniel-GrunbergerCA
2021-11-10 18:57:05 +02:00
parent 1fb642c777
commit 37cdf1a19e
2 changed files with 21 additions and 5 deletions
+5 -1
View File
@@ -50,7 +50,11 @@ func (armoAPI *ArmoAPI) GetCustomFrameworksForCustomer(customerGUID string) ([]s
err = json.Unmarshal([]byte(respStr), &frs)
for _, fr := range frs {
frameworkList = append(frameworkList, fr.Name)
if isNativeFramework(fr.Name) {
frameworkList = append(frameworkList, strings.ToLower(fr.Name))
} else {
frameworkList = append(frameworkList, fr.Name)
}
}
return frameworkList, nil
+16 -4
View File
@@ -196,10 +196,22 @@ func Submit(submitInterfaces cliinterfaces.SubmitInterfaces) error {
func SetScanForGivenFrameworks(scanInfo *cautils.ScanInfo, frameworks []string) *cautils.ScanInfo {
for _, framework := range frameworks {
newPolicy := reporthandling.PolicyIdentifier{}
newPolicy.Kind = reporthandling.KindFramework
newPolicy.Name = framework
scanInfo.PolicyIdentifier = append(scanInfo.PolicyIdentifier, newPolicy)
if !contains(scanInfo, framework) {
newPolicy := reporthandling.PolicyIdentifier{}
newPolicy.Kind = reporthandling.KindFramework
newPolicy.Name = framework
scanInfo.PolicyIdentifier = append(scanInfo.PolicyIdentifier, newPolicy)
}
}
return scanInfo
}
func contains(scanInfo *cautils.ScanInfo, framework string) bool {
for _, policy := range scanInfo.PolicyIdentifier {
if policy.Name == framework {
return true
}
}
return false
}