-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1847 from akto-api-security/feature/export_select…
…ed_issues Feature/export selected issues
- Loading branch information
Showing
14 changed files
with
326 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
apps/dashboard/src/main/java/com/akto/action/testing/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.akto.action.testing; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.bson.conversions.Bson; | ||
|
||
import com.akto.dto.ApiInfo.ApiInfoKey; | ||
import com.akto.dto.testing.GenericTestResult; | ||
import com.akto.dto.testing.TestingRunResult; | ||
import com.akto.dto.type.SingleTypeInfo; | ||
import com.mongodb.client.model.Filters; | ||
|
||
public class Utils { | ||
|
||
public static Bson createFiltersForTestingReport(Map<String, List<String>> filterMap){ | ||
List<Bson> filterList = new ArrayList<>(); | ||
for(Map.Entry<String, List<String>> entry: filterMap.entrySet()) { | ||
String key = entry.getKey(); | ||
List<String> value = entry.getValue(); | ||
|
||
if (value.size() == 0) continue; | ||
List<Integer> collectionIds = new ArrayList<>(); | ||
if(key.equals(SingleTypeInfo._API_COLLECTION_ID)){ | ||
for(String str: value){ | ||
collectionIds.add(Integer.parseInt(str)); | ||
} | ||
} | ||
|
||
switch (key) { | ||
case SingleTypeInfo._METHOD: | ||
filterList.add(Filters.in(TestingRunResult.API_INFO_KEY + "." + ApiInfoKey.METHOD, value)); | ||
break; | ||
case SingleTypeInfo._API_COLLECTION_ID: | ||
filterList.add(Filters.in(TestingRunResult.API_INFO_KEY + "." + ApiInfoKey.API_COLLECTION_ID, collectionIds)); | ||
break; | ||
case "categoryFilter": | ||
filterList.add(Filters.in(TestingRunResult.TEST_SUPER_TYPE, value)); | ||
break; | ||
case "severityStatus": | ||
filterList.add(Filters.in(TestingRunResult.TEST_RESULTS + ".0." + GenericTestResult._CONFIDENCE, value)); | ||
default: | ||
break; | ||
} | ||
} | ||
return Filters.and(filterList); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.