NIFI-12862 When building FlowAnalysisRuleViolationDTO objects (in StandardNiFiServiceFacade), violating component details will be left blank when user has no read permission for that component.

NIFI-12862 Expose subjectComponentType to frontend.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #8475.
This commit is contained in:
tpalfy 2024-03-05 17:48:08 +01:00 committed by Pierre Villard
parent f8d3fcd66c
commit c093ea54b7
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
2 changed files with 29 additions and 10 deletions

View File

@ -35,6 +35,8 @@ public class FlowAnalysisRuleViolationDTO {
private String issueId;
private String violationMessage;
private String subjectComponentType;
private PermissionsDTO subjectPermissionDto;
private boolean enabled;
@ -129,6 +131,17 @@ public class FlowAnalysisRuleViolationDTO {
}
/**
* @return the type of the subject that violated the rule
*/
public String getSubjectComponentType() {
return subjectComponentType;
}
public void setSubjectComponentType(String subjectComponentType) {
this.subjectComponentType = subjectComponentType;
}
/**
* @return true if this result should be in effect, false otherwise
*/

View File

@ -6478,23 +6478,29 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
.map(ruleViolation -> {
FlowAnalysisRuleViolationDTO ruleViolationDto = new FlowAnalysisRuleViolationDTO();
ruleViolationDto.setEnforcementPolicy(ruleViolation.getEnforcementPolicy().toString());
ruleViolationDto.setScope(ruleViolation.getScope());
ruleViolationDto.setRuleId(ruleViolation.getRuleId());
ruleViolationDto.setIssueId(ruleViolation.getIssueId());
ruleViolationDto.setViolationMessage(ruleViolation.getViolationMessage());
String subjectId = ruleViolation.getSubjectId();
String groupId = ruleViolation.getGroupId();
ruleViolationDto.setScope(ruleViolation.getScope());
ruleViolationDto.setSubjectId(subjectId);
ruleViolationDto.setGroupId(groupId);
ruleViolationDto.setSubjectDisplayName(ruleViolation.getSubjectDisplayName());
ruleViolationDto.setSubjectPermissionDto(createPermissionDto(
ruleViolationDto.setRuleId(ruleViolation.getRuleId());
ruleViolationDto.setIssueId(ruleViolation.getIssueId());
ruleViolationDto.setSubjectComponentType(ruleViolation.getSubjectComponentType().name());
ruleViolationDto.setEnforcementPolicy(ruleViolation.getEnforcementPolicy().toString());
PermissionsDTO subjectPermissionDto = createPermissionDto(
subjectId,
ruleViolation.getSubjectComponentType(),
groupId
));
);
ruleViolationDto.setSubjectPermissionDto(subjectPermissionDto);
if (subjectPermissionDto.getCanRead()) {
ruleViolationDto.setGroupId(groupId);
ruleViolationDto.setSubjectDisplayName(ruleViolation.getSubjectDisplayName());
ruleViolationDto.setViolationMessage(ruleViolation.getViolationMessage());
}
return ruleViolationDto;
})