Require adminFeeds access to see NiFi flows
@@ -27,6 +27,7 @@ import com.thinkbiganalytics.feedmgr.nifi.DBCPConnectionPoolTableInfo;
import com.thinkbiganalytics.feedmgr.nifi.NifiConnectionService;
import com.thinkbiganalytics.feedmgr.nifi.PropertyExpressionResolver;
import com.thinkbiganalytics.feedmgr.nifi.SpringEnvironmentProperties;
+import com.thinkbiganalytics.feedmgr.security.FeedServicesAccessControl;
import com.thinkbiganalytics.feedmgr.service.template.FeedManagerTemplateService;
import com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient;
import com.thinkbiganalytics.nifi.rest.client.NiFiRestClient;
@@ -37,6 +38,7 @@ import com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptorTransform;
import com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowDeserializer;
import com.thinkbiganalytics.nifi.rest.model.flow.NifiFlowProcessGroup;
import com.thinkbiganalytics.rest.model.RestResponseStatus;
+import com.thinkbiganalytics.security.AccessController;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.web.api.dto.ControllerServiceDTO;
@@ -114,6 +116,9 @@ public class NifiIntegrationRestController {
@Inject
private SpringEnvironmentProperties environmentProperties;
+ @Inject
+ private AccessController accessController;
+
@GET
@Path("/auto-align/{processGroupId}")
@Produces(MediaType.APPLICATION_JSON)
@@ -179,6 +184,8 @@ public class NifiIntegrationRestController {
@ApiResponse(code = 500, message = "The process group is unavailable.", response = RestResponseStatus.class)
})
public Response getFlow(@PathParam("processGroupId") String processGroupId) {
+ accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_FEEDS);
+
NifiFlowProcessGroup flow = legacyNifiRestClient.getFeedFlow(processGroupId);
NifiFlowDeserializer.prepareForSerialization(flow);
return Response.ok(flow).build();
@@ -193,6 +200,8 @@ public class NifiIntegrationRestController {
@ApiResponse(code = 500, message = "The process group is unavailable.", response = RestResponseStatus.class)
})
public Response getFlowForCategoryAndFeed(@PathParam("categoryAndFeedName") String categoryAndFeedName) {
+ accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_FEEDS);
+
NifiFlowProcessGroup flow = legacyNifiRestClient.getFeedFlowForCategoryAndFeed(categoryAndFeedName);
NifiFlowDeserializer.prepareForSerialization(flow);
return Response.ok(flow).build();
@@ -209,6 +218,8 @@ public class NifiIntegrationRestController {
@ApiResponse(code = 500, message = "NiFi is unavailable.", response = RestResponseStatus.class)
})
public Response getFlows() {
+ accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.ADMIN_FEEDS);
+
List<NifiFlowProcessGroup> feedFlows = legacyNifiRestClient.getFeedFlows();
if (feedFlows != null) {
log.info("********************** getAllFlows ({})", feedFlows.size());
