diff --git a/cypress/e2e/7-workflow-actions.cy.ts b/cypress/e2e/7-workflow-actions.cy.ts index 65795cf949..ef15dd97d7 100644 --- a/cypress/e2e/7-workflow-actions.cy.ts +++ b/cypress/e2e/7-workflow-actions.cy.ts @@ -4,6 +4,8 @@ import { META_KEY, SCHEDULE_TRIGGER_NODE_NAME, EDIT_FIELDS_SET_NODE_NAME, + INSTANCE_MEMBERS, + INSTANCE_OWNER, } from '../constants'; import { WorkflowPage as WorkflowPageClass } from '../pages/workflow'; import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows'; @@ -276,3 +278,19 @@ describe('Workflow Actions', () => { WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible'); }); }); + +describe('Menu entry Push To Git', () => { + it('should not show up in the menu for members', () => { + cy.signin(INSTANCE_MEMBERS[0]); + cy.visit(WorkflowPages.url); + WorkflowPage.actions.visit(); + WorkflowPage.getters.workflowMenuItemGitPush().should('not.exist'); + }); + + it('should show up for owners', () => { + cy.signin(INSTANCE_OWNER); + cy.visit(WorkflowPages.url); + WorkflowPage.actions.visit(); + WorkflowPage.getters.workflowMenuItemGitPush().should('exist'); + }); +}); diff --git a/cypress/pages/workflow.ts b/cypress/pages/workflow.ts index 309915d398..85ed98d582 100644 --- a/cypress/pages/workflow.ts +++ b/cypress/pages/workflow.ts @@ -71,6 +71,7 @@ export class WorkflowPage extends BasePage { workflowMenuItemImportFromFile: () => cy.getByTestId('workflow-menu-item-import-from-file'), workflowMenuItemSettings: () => cy.getByTestId('workflow-menu-item-settings'), workflowMenuItemDelete: () => cy.getByTestId('workflow-menu-item-delete'), + workflowMenuItemGitPush: () => cy.getByTestId('workflow-menu-item-push'), // Workflow settings dialog elements workflowSettingsModal: () => cy.getByTestId('workflow-settings-dialog'), workflowSettingsErrorWorkflowSelect: () => cy.getByTestId('workflow-settings-error-workflow'), diff --git a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue index 927967a114..8ddd6ebb18 100644 --- a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue +++ b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue @@ -241,6 +241,9 @@ export default defineComponent({ currentUser(): IUser | null { return this.usersStore.currentUser; }, + currentUserIsOwner(): boolean { + return this.usersStore.currentUser?.isOwner ?? false; + }, contextBasedTranslationKeys(): NestedRecord { return this.uiStore.contextBasedTranslationKeys; }, @@ -321,15 +324,18 @@ export default defineComponent({ ); } - actions.push({ - id: WORKFLOW_MENU_ACTIONS.PUSH, - label: this.$locale.baseText('menuActions.push'), - disabled: - !this.sourceControlStore.isEnterpriseSourceControlEnabled || - !this.onWorkflowPage || - this.onExecutionsTab || - this.readOnlyEnv, - }); + if (this.currentUserIsOwner) { + actions.push({ + id: WORKFLOW_MENU_ACTIONS.PUSH, + label: this.$locale.baseText('menuActions.push'), + disabled: + !this.sourceControlStore.isEnterpriseSourceControlEnabled || + !this.onWorkflowPage || + this.onExecutionsTab || + this.readOnlyEnv || + !this.currentUserIsOwner, + }); + } actions.push({ id: WORKFLOW_MENU_ACTIONS.SETTINGS,