Skip to content

Commit

Permalink
Fix merge errors
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Bickert <rbt@mm-software.com>
  • Loading branch information
rbt-mm committed Sep 17, 2024
1 parent ebfb388 commit 5bd46d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ private void processInputFilter(Map<String, Object> params, List<String> filterC
}
}

private void preprocessACLs(final Query<PolicyViolation> query, final String inputFilter, final Map<String, Object> params, final boolean bypass) {
@Override
void preprocessACLs(final Query<?> query, final String inputFilter, final Map<String, Object> params, final boolean bypass) {
if (super.principal != null && isEnabled(ConfigPropertyConstants.ACCESS_MANAGEMENT_ACL_ENABLED) && !bypass) {
final List<Team> teams;
if (super.principal instanceof UserPrincipal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,23 @@ public class PolicyViolationResource extends AlpineResource {
@PermissionRequired(Permissions.Constants.VIEW_POLICY_VIOLATION)
public Response getViolations(@Parameter(description = "Optionally includes suppressed violations")
@QueryParam("suppressed") boolean suppressed,
@ApiParam(value = "Optionally includes inactive projects")
@PathParam(value = "Optionally includes inactive projects")
@QueryParam("showInactive") boolean showInactive,
@ApiParam(value = "Filter by violation state")
@PathParam(value = "Filter by violation state")
@QueryParam("violationState") String violationState,
@ApiParam(value = "Filter by risk type")
@PathParam(value = "Filter by risk type")
@QueryParam("riskType") String riskType,
@ApiParam(value = "Filter by policy")
@PathParam(value = "Filter by policy")
@QueryParam("policy") String policy,
@ApiParam(value = "Filter by analysis state")
@PathParam(value = "Filter by analysis state")
@QueryParam("analysisState") String analysisState,
@ApiParam(value = "Filter occurred on from")
@PathParam(value = "Filter occurred on from")
@QueryParam("occurredOnDateFrom") String occurredOnDateFrom,
@ApiParam(value = "Filter occurred on to")
@PathParam(value = "Filter occurred on to")
@QueryParam("occurredOnDateTo") String occurredOnDateTo,
@ApiParam(value = "Filter the text input in these fields")
@PathParam(value = "Filter the text input in these fields")
@QueryParam("textSearchField") String textSearchField,
@ApiParam(value = "Filter by this text input")
@PathParam(value = "Filter by this text input")
@QueryParam("textSearchInput") String textSearchInput) {
try (QueryManager qm = new QueryManager(getAlpineRequest())) {
Map<String, String> filters = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public void getViolationsWithAclEnabledTest() {
violationD.setTimestamp(new Date());
violationD = qm.persist(violationD);

final Response responseA = target(V1_POLICY_VIOLATION)
final Response responseA = jersey.target(V1_POLICY_VIOLATION)
.request()
.header(X_API_KEY, apiKey)
.get();
Expand All @@ -393,7 +393,7 @@ public void getViolationsWithAclEnabledTest() {
qm.persist(aclToggle);
}

final Response responseB = target(V1_POLICY_VIOLATION)
final Response responseB = jersey.target(V1_POLICY_VIOLATION)
.request()
.header(X_API_KEY, team.getApiKeys().get(0).getKey())
.get();
Expand Down Expand Up @@ -474,15 +474,15 @@ public void getViolationsWithArrayFilter() {
violationD.setTimestamp(new Date());
violationD = qm.persist(violationD);

final Response response = target(V1_POLICY_VIOLATION)
final Response response = jersey.target(V1_POLICY_VIOLATION)
.request()
.header(X_API_KEY, apiKey)
.get();
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
assertThat(response.getHeaderString(TOTAL_COUNT_HEADER)).isEqualTo("4");
assertThat(parseJsonArray(response)).hasSize(4);

final Response responseA = target(V1_POLICY_VIOLATION).queryParam("violationState", "FAIL")
final Response responseA = jersey.target(V1_POLICY_VIOLATION).queryParam("violationState", "FAIL")
.request()
.header(X_API_KEY, apiKey)
.get();
Expand All @@ -493,7 +493,7 @@ public void getViolationsWithArrayFilter() {
assertThat(jsonArrayA.getJsonObject(0).getString("uuid")).isEqualTo(violationA.getUuid().toString());


final Response responseB = target(V1_POLICY_VIOLATION).queryParam("riskType", "LICENSE")
final Response responseB = jersey.target(V1_POLICY_VIOLATION).queryParam("riskType", "LICENSE")
.request()
.header(X_API_KEY, apiKey)
.get();
Expand All @@ -504,7 +504,7 @@ public void getViolationsWithArrayFilter() {
assertThat(jsonArrayB.getJsonObject(0).getString("uuid")).isEqualTo(violationB.getUuid().toString());
assertThat(jsonArrayB.getJsonObject(0).getString("uuid")).isEqualTo(violationB.getUuid().toString());

final Response responseC = target(V1_POLICY_VIOLATION).queryParam("analysisState", "REJECTED")
final Response responseC = jersey.target(V1_POLICY_VIOLATION).queryParam("analysisState", "REJECTED")
.request()
.header(X_API_KEY, apiKey)
.get();
Expand All @@ -515,7 +515,7 @@ public void getViolationsWithArrayFilter() {
assertThat(jsonArrayC.getJsonObject(0).getString("uuid")).isEqualTo(violationC.getUuid().toString());
assertThat(jsonArrayC.getJsonObject(0).getString("uuid")).isEqualTo(violationC.getUuid().toString());

final Response responseD = target(V1_POLICY_VIOLATION).queryParam("policy", policyD.getUuid().toString())
final Response responseD = jersey.target(V1_POLICY_VIOLATION).queryParam("policy", policyD.getUuid().toString())
.request()
.header(X_API_KEY, apiKey)
.get();
Expand Down Expand Up @@ -600,15 +600,15 @@ public void getViolationsWithInputFilter() {
violationD.setTimestamp(new Date());
violationD = qm.persist(violationD);

final Response response = target(V1_POLICY_VIOLATION)
final Response response = jersey.target(V1_POLICY_VIOLATION)
.request()
.header(X_API_KEY, apiKey)
.get();
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
assertThat(response.getHeaderString(TOTAL_COUNT_HEADER)).isEqualTo("4");
assertThat(parseJsonArray(response)).hasSize(4);

final Response responseA = target(V1_POLICY_VIOLATION)
final Response responseA = jersey.target(V1_POLICY_VIOLATION)
.queryParam("textSearchField", "policy_name")
.queryParam("textSearchInput", "Policy A")
.request()
Expand All @@ -620,7 +620,7 @@ public void getViolationsWithInputFilter() {
assertThat(jsonArrayA).hasSize(1);
assertThat(jsonArrayA.getJsonObject(0).getString("uuid")).isEqualTo(violationA.getUuid().toString());

final Response responseB = target(V1_POLICY_VIOLATION)
final Response responseB = jersey.target(V1_POLICY_VIOLATION)
.queryParam("textSearchField", "component")
.queryParam("textSearchInput", "Component B")
.request()
Expand All @@ -632,7 +632,7 @@ public void getViolationsWithInputFilter() {
assertThat(jsonArrayB).hasSize(1);
assertThat(jsonArrayB.getJsonObject(0).getString("uuid")).isEqualTo(violationB.getUuid().toString());

final Response responseC = target(V1_POLICY_VIOLATION)
final Response responseC = jersey.target(V1_POLICY_VIOLATION)
.queryParam("textSearchField", "license")
.queryParam("textSearchInput", "License C")
.request()
Expand All @@ -644,7 +644,7 @@ public void getViolationsWithInputFilter() {
assertThat(jsonArrayC).hasSize(1);
assertThat(jsonArrayC.getJsonObject(0).getString("uuid")).isEqualTo(violationC.getUuid().toString());

final Response responseD = target(V1_POLICY_VIOLATION)
final Response responseD = jersey.target(V1_POLICY_VIOLATION)
.queryParam("textSearchField", "project_name")
.queryParam("textSearchInput", "Project D")
.request()
Expand Down

0 comments on commit 5bd46d6

Please sign in to comment.