mirror of https://github.com/apache/nifi.git
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:
parent
f8d3fcd66c
commit
c093ea54b7
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue