Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: permission update (#10356)
ecmadaoc4d086d95670
diff --git a/frontend/src/components/Database/DatabaseBackupPanel.vue b/frontend/src/components/Database/DatabaseBackupPanel.vueindex 30ac5cec31..10787ce047 100644--- a/frontend/src/components/Database/DatabaseBackupPanel.vue+++ b/frontend/src/components/Database/DatabaseBackupPanel.vue@@ -112,11 +112,11 @@<PITRRestoreButtonv-if="allowUpdateDatabase":database="database"- :allow-admin="allowUpdateDatabase"+ :allow-admin="allowCreateBackup"/><NButton- v-if="allowUpdateDatabase && !disableBackupButton"+ v-if="allowCreateBackup"type="primary"@click.prevent="state.showCreateBackupModal = true">@@ -125,6 +125,7 @@</div></div><BackupTable+ v-if="allowListBackup":database="database":backup-list="backupList":allow-edit="allowUpdateDatabase"@@ -211,7 +212,6 @@ import {PolicyType,BackupPlanSchedule,} from "@/types/proto/v1/org_policy_service";-import { instanceV1HasBackupRestore } from "@/utils";interface LocalState {showCreateBackupModal: boolean;@@ -233,8 +233,12 @@ const props = defineProps<{const backupStore = useBackupV1Store();const policyV1Store = usePolicyV1Store();const { t } = useI18n();-const { allowUpdateDatabase, allowUpdateBackupSetting } =- useDatabaseDetailContext();+const {+ allowUpdateDatabase,+ allowUpdateBackupSetting,+ allowListBackup,+ allowCreateBackup,+} = useDatabaseDetailContext();const state = reactive<LocalState>({showCreateBackupModal: false,@@ -284,10 +288,6 @@ const assignBackupSetting = (backupSetting: BackupSetting) => {state.backupSetting = backupSetting;};-const disableBackupButton = computed(() => {- return !instanceV1HasBackupRestore(props.database.instanceEntity);-});-// List PENDING_CREATE backups first, followed by backups in createdTs descending order.const backupList = computed(() => {const list = [...backupStore.backupListByDatabase(props.database.name)];diff --git a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue b/frontend/src/components/Database/DatabaseChangeHistoryPanel.vueindex 83bb4bdb3c..f9ea778c66 100644--- a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue+++ b/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue@@ -48,6 +48,7 @@<TooltipButtonv-if="allowMigrate"tooltip-mode="DISABLED-ONLY"+ :disabled="false"type="primary"@click="state.showBaselineModal = true">diff --git a/frontend/src/components/Database/context.ts b/frontend/src/components/Database/context.tsindex 2f4eebfcb1..9d417648d4 100644--- a/frontend/src/components/Database/context.ts+++ b/frontend/src/components/Database/context.ts@@ -1,11 +1,11 @@import { InjectionKey, Ref, computed, inject, provide, unref } from "vue";-import { useDatabaseV1Store, useCurrentUserV1 } from "../../store";+import { useDatabaseV1Store, useCurrentUserV1 } from "@/store";import {ComposedDatabase,MaybeRef,ProjectPermission,DEFAULT_PROJECT_V1_NAME,-} from "../../types";+} from "@/types";import {idFromSlug,hasProjectPermissionV2,@@ -13,7 +13,7 @@ import {instanceV1SupportSlowQuery,isArchivedDatabaseV1,instanceV1HasBackupRestore,-} from "../../utils";+} from "@/utils";export type DatabaseDetailContext = {database: Ref<ComposedDatabase>;@@ -21,6 +21,8 @@ export type DatabaseDetailContext = {allowUpdateDatabase: Ref<boolean>;allowSyncDatabase: Ref<boolean>;allowTransferDatabase: Ref<boolean>;+ allowListBackup: Ref<boolean>;+ allowCreateBackup: Ref<boolean>;allowGetBackupSetting: Ref<boolean>;allowUpdateBackupSetting: Ref<boolean>;allowGetSchema: Ref<boolean>;@@ -77,6 +79,12 @@ export const provideDatabaseDetailContext = (return allowUpdateDatabase.value;});+ const allowListBackup = computed(() => checkPermission("bb.backups.list"));+ const allowCreateBackup = computed(+ () =>+ checkPermission("bb.backups.create") &&+ instanceV1HasBackupRestore(database.value.instanceEntity)+ );const allowGetBackupSetting = computed(() =>checkPermission("bb.databases.getBackupSetting") &&@@ -132,6 +140,8 @@ export const provideDatabaseDetailContext = (allowUpdateDatabase,allowSyncDatabase,allowTransferDatabase,+ allowListBackup,+ allowCreateBackup,allowGetBackupSetting,allowUpdateBackupSetting,allowGetSchema,diff --git a/frontend/src/views/ChangeHistoryDetail.vue b/frontend/src/views/ChangeHistoryDetail.vueindex c08b482909..cc84a21c7b 100644--- a/frontend/src/views/ChangeHistoryDetail.vue+++ b/frontend/src/views/ChangeHistoryDetail.vue@@ -1,9 +1,10 @@<template>- <div class="focus:outline-none" tabindex="0" v-bind="$attrs">- <main v-if="changeHistory" class="flex flex-col relative pb-8 gap-y-6">+ <div class="focus:outline-none px-4 pb-4" tabindex="0" v-bind="$attrs">+ <NoPermissionPlaceholder v-if="!hasPermission" />+ <main v-else-if="changeHistory" class="flex flex-col relative gap-y-6"><!-- Highlight Panel --><div- class="px-4 pb-4 border-b border-block-border md:flex md:items-center md:justify-between"+ class="pb-4 border-b border-block-border md:flex md:items-center md:justify-between"><div class="flex-1 min-w-0 space-y-3"><!-- Summary -->@@ -103,7 +104,7 @@</div></div>- <div v-if="affectedTables.length > 0" class="px-4">+ <div v-if="affectedTables.length > 0"><span class="flex items-center text-lg text-main capitalize">{{ $t("change-history.affected-tables") }}</span>@@ -127,7 +128,7 @@</div></div>- <div class="px-4 flex flex-col gap-y-6">+ <div class="flex flex-col gap-y-6"><div class="flex flex-col gap-y-2"><aid="statement"@@ -340,6 +341,7 @@ import {useDBSchemaV1Store,useDatabaseV1Store,useUserStore,+ useCurrentUserV1,useInstanceV1Store,useSettingV1Store,} from "@/store";@@ -362,6 +364,7 @@ import {getAffectedTablesOfChangeHistory,toClipboard,getStatementSize,+ hasProjectPermissionV2,extractProjectResourceName,} from "@/utils";@@ -399,6 +402,14 @@ const database = computed(() => {return databaseStore.getDatabaseByName(changeHistoryParent.value);});+const hasPermission = computed(() =>+ hasProjectPermissionV2(+ database.value.projectEntity,+ useCurrentUserV1().value,+ "bb.changeHistories.get"+ )+);+const classificationConfig = computed(() => {return settingStore.getProjectClassification(database.value.projectEntity.dataClassificationConfigId