mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +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:
@@ -3,12 +3,11 @@ import { computed, nextTick, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { createEventBus } from 'n8n-design-system/utils';
|
||||
import { useI18n } from '@/composables/useI18n';
|
||||
import { useMessage } from '@/composables/useMessage';
|
||||
import { hasPermission } from '@/rbac/permissions';
|
||||
import { useToast } from '@/composables/useToast';
|
||||
import { useLoadingService } from '@/composables/useLoadingService';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { SOURCE_CONTROL_PULL_MODAL_KEY, SOURCE_CONTROL_PUSH_MODAL_KEY, VIEWS } from '@/constants';
|
||||
import type { SourceControlAggregatedFile } from '../Interface';
|
||||
import { sourceControlEventBus } from '@/event-bus/source-control';
|
||||
@@ -24,9 +23,7 @@ const responseStatuses = {
|
||||
const router = useRouter();
|
||||
const loadingService = useLoadingService();
|
||||
const uiStore = useUIStore();
|
||||
const usersStore = useUsersStore();
|
||||
const sourceControlStore = useSourceControlStore();
|
||||
const message = useMessage();
|
||||
const toast = useToast();
|
||||
const i18n = useI18n();
|
||||
|
||||
@@ -36,8 +33,11 @@ const tooltipOpenDelay = ref(300);
|
||||
const currentBranch = computed(() => {
|
||||
return sourceControlStore.preferences.branchName;
|
||||
});
|
||||
const isInstanceOwner = computed(() => usersStore.isInstanceOwner);
|
||||
const setupButtonTooltipPlacement = computed(() => (props.isCollapsed ? 'right' : 'top'));
|
||||
const sourceControlAvailable = computed(
|
||||
() =>
|
||||
sourceControlStore.isEnterpriseSourceControlEnabled &&
|
||||
hasPermission(['rbac'], { rbac: { scope: 'sourceControl:manage' } }),
|
||||
);
|
||||
|
||||
async function pushWorkfolder() {
|
||||
loadingService.startLoading();
|
||||
@@ -125,7 +125,7 @@ const goToSourceControlSetup = async () => {
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="sourceControlStore.isEnterpriseSourceControlEnabled && isInstanceOwner"
|
||||
v-if="sourceControlAvailable"
|
||||
:class="{
|
||||
[$style.sync]: true,
|
||||
[$style.collapsed]: isCollapsed,
|
||||
|
||||
Reference in New Issue
Block a user