rfellows commented on code in PR #11836:
URL: https://github.com/apache/nifi/pull/11836#discussion_r4352747085
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/connectors/ui/connector-canvas/connector-canvas.component.ts:
##########
@@ -1039,6 +1069,45 @@ export class ConnectorCanvasComponent implements OnInit,
OnDestroy {
this.store.dispatch(ConnectorCanvasActions.navigateToControllerServices({
processGroupId }));
}
+ downloadFlowAction(includeReferencedServices: boolean): void {
+ const processGroupId = this.getDownloadProcessGroupId();
+ if (this.currentConnectorId && processGroupId) {
+ this.store.dispatch(
+ ConnectorCanvasActions.downloadFlow({
+ request: {
+ connectorId: this.currentConnectorId,
+ processGroupId,
+ includeReferencedServices
+ }
+ })
+ );
+ }
+ }
+
+ private canDownloadFlow(): boolean {
+ return this.connectorEntity()?.permissions.canRead === true &&
this.getDownloadProcessGroupId() !== null;
+ }
+
+ private getDownloadProcessGroupId(): string | null {
+ const context = this.currentContextMenuContext;
+ if (context?.targetType === 'canvas') {
+ return this.currentProcessGroupId;
+ }
+
+ if (context?.targetType === 'component') {
+ const clicked = context.clickedComponent;
+ if (
+ context.selectedComponents.length <= 1 &&
+ clicked?.ui.componentType === ComponentType.ProcessGroup &&
+ clicked.entity.permissions.canRead === true
Review Comment:
Could we remove the child Process Group `canRead` check here? The new
Connector-scoped endpoint intentionally authorizes this operation using
Connector READ, with Connector WRITE required only when exporting state.
Keeping this additional UI check means an authorized user can export the child
through the API or Toolkit but the canvas hides the action.
I think eligibility here should rely on the Connector permission checked by
`canDownloadFlow()`. The corresponding "unreadable Process Group" test should
then verify that Connector READ still permits the download.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]