Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2468#discussion_r173511759
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
 ---
    @@ -4506,6 +4515,123 @@ public ComponentHistoryDTO 
getComponentHistory(final String componentId) {
             return history;
         }
     
    +    private ControllerServiceEntity createControllerServiceEntity(final 
String serviceId, final NiFiUser user) {
    +        final ControllerServiceNode serviceNode = 
controllerServiceDAO.getControllerService(serviceId);
    +        return createControllerServiceEntity(serviceNode, 
Collections.emptySet(), user);
    +    }
    +
    +    @Override
    +    public ProcessorDiagnosticsEntity getProcessorDiagnostics(final String 
id) {
    +        final ProcessorNode processor = processorDAO.getProcessor(id);
    +        final ProcessorStatus processorStatus = 
controllerFacade.getProcessorStatus(id);
    +
    +        // Generate Processor Diagnostics
    +        final NiFiUser user = NiFiUserUtils.getNiFiUser();
    +        final ProcessorDiagnosticsDTO dto = 
controllerFacade.getProcessorDiagnostics(processor, processorStatus, 
bulletinRepository, serviceId -> createControllerServiceEntity(serviceId, 
user));
    +
    +        // Filter anything out of diagnostics that the user is not 
authorized to see.
    +        final List<JVMDiagnosticsSnapshotDTO> jvmDiagnosticsSnaphots = new 
ArrayList<>();
    +        final JVMDiagnosticsDTO jvmDiagnostics = dto.getJvmDiagnostics();
    +        jvmDiagnosticsSnaphots.add(jvmDiagnostics.getAggregateSnapshot());
    +
    +        // filter controller-related information
    +        final boolean canReadController = 
authorizableLookup.getController().isAuthorized(authorizer, RequestAction.READ, 
user);
    +        if (!canReadController) {
    +            for (final JVMDiagnosticsSnapshotDTO snapshot : 
jvmDiagnosticsSnaphots) {
    --- End diff --
    
    Thoughts about active event/timer driven threads, cluster details like 
primary and coordinator, and uptime? Should these also be filtered out here?


---

Reply via email to