mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Replace isInstanceOwner checks with scopes where applicable (#7858)
Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
@@ -184,6 +184,7 @@ import { getWorkflowPermissions } from '@/permissions';
|
||||
import { createEventBus } from 'n8n-design-system/utils';
|
||||
import { nodeViewEventBus } from '@/event-bus';
|
||||
import { genericHelpers } from '@/mixins/genericHelpers';
|
||||
import { hasPermission } from '@/rbac/permissions';
|
||||
|
||||
const hasChanged = (prev: string[], curr: string[]) => {
|
||||
if (prev.length !== curr.length) {
|
||||
@@ -247,10 +248,7 @@ export default defineComponent({
|
||||
currentUser(): IUser | null {
|
||||
return this.usersStore.currentUser;
|
||||
},
|
||||
currentUserIsOwner(): boolean {
|
||||
return this.usersStore.currentUser?.isOwner ?? false;
|
||||
},
|
||||
contextBasedTranslationKeys(): NestedRecord<string> {
|
||||
contextBasedTranslationKeys() {
|
||||
return this.uiStore.contextBasedTranslationKeys;
|
||||
},
|
||||
isWorkflowActive(): boolean {
|
||||
@@ -298,7 +296,7 @@ export default defineComponent({
|
||||
].includes(this.$route.name || '');
|
||||
},
|
||||
workflowPermissions(): IPermissions {
|
||||
return getWorkflowPermissions(this.usersStore.currentUser, this.workflow);
|
||||
return getWorkflowPermissions(this.currentUser, this.workflow);
|
||||
},
|
||||
workflowMenuItems(): Array<{}> {
|
||||
const actions = [
|
||||
@@ -330,7 +328,7 @@ export default defineComponent({
|
||||
);
|
||||
}
|
||||
|
||||
if (this.currentUserIsOwner) {
|
||||
if (hasPermission(['rbac'], { rbac: { scope: 'sourceControl:push' } })) {
|
||||
actions.push({
|
||||
id: WORKFLOW_MENU_ACTIONS.PUSH,
|
||||
label: this.$locale.baseText('menuActions.push'),
|
||||
@@ -338,8 +336,7 @@ export default defineComponent({
|
||||
!this.sourceControlStore.isEnterpriseSourceControlEnabled ||
|
||||
!this.onWorkflowPage ||
|
||||
this.onExecutionsTab ||
|
||||
this.readOnlyEnv ||
|
||||
!this.currentUserIsOwner,
|
||||
this.readOnlyEnv,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user