Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: do not get database in masking exemption policy (#19211)
ecmadaob4981d66cad9
diff --git a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vueindex f8a0acd384..3f04dd270b 100644--- a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue+++ b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue@@ -15,30 +15,25 @@<script lang="tsx" setup>import { create } from "@bufbuild/protobuf";import { orderBy } from "lodash-es";-import { InfoIcon, TrashIcon } from "lucide-vue-next";+import { TrashIcon } from "lucide-vue-next";import type { DataTableColumn } from "naive-ui";-import { NDataTable, NDatePicker, NTooltip, useDialog } from "naive-ui";+import { NDataTable, NDatePicker, NEllipsis, useDialog } from "naive-ui";import type { VNodeChild } from "vue";import { computed, h, reactive, watchEffect } from "vue";import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";-import {- DatabaseV1Name,- InstanceV1Name,- MiniActionButton,-} from "@/components/v2";+import { MiniActionButton } from "@/components/v2";import { UserLink } from "@/components/v2/Model/cells";import {composePolicyBindings,extractUserId,pushNotification,- useDatabaseV1Store,useGroupStore,usePolicyByParentAndType,usePolicyV1Store,} from "@/store";-import { groupBindingPrefix, isValidDatabaseName } from "@/types";+import { groupBindingPrefix } from "@/types";import { ExprSchema } from "@/types/proto-es/google/type/expr_pb";import type { MaskingExemptionPolicy_Exemption } from "@/types/proto-es/v1/org_policy_service_pb";import {@@ -46,7 +41,7 @@ import {PolicyType,} from "@/types/proto-es/v1/org_policy_service_pb";import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { autoDatabaseRoute, getInstanceResource } from "@/utils";+import { hasProjectPermissionV2 } from "@/utils";import {batchConvertFromCELString,type ConditionExpression,@@ -75,10 +70,13 @@ const state = reactive<LocalState>({const { t } = useI18n();const router = useRouter();const groupStore = useGroupStore();-const databaseStore = useDatabaseV1Store();const policyStore = usePolicyV1Store();const $dialog = useDialog();+const hasGetDatabasePermission = computed(() =>+ hasProjectPermissionV2(props.project, "bb.databases.get")+);+const { policy, ready } = usePolicyByParentAndType(computed(() => ({parentPath: props.project.name,@@ -90,69 +88,41 @@ const filteredList = computed(() =>state.rawAccessList.filter(props.filterAccessUser));-const isValidDatabaseResource = (access: AccessUser): boolean => {- if (!access.databaseResource) {- return false;- }- const database = databaseStore.getDatabaseByName(- access.databaseResource.databaseFullName- );- return isValidDatabaseName(database.name);-};-const getDatabaseAccessResource = (access: AccessUser): VNodeChild => {if (!access.databaseResource) {return <div class="textinfo">{t("database.all")}</div>;}- const database = databaseStore.getDatabaseByName(- access.databaseResource.databaseFullName- );- const validDatabase = isValidDatabaseResource(access);return (<div class="flex flex-col gap-y-1">- {validDatabase && (- <div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">- <span class="font-medium">{`${t("common.instance")}:`}</span>- <InstanceV1Name instance={getInstanceResource(database)} />- </div>- )}<div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo"><span class="font-medium">{`${t("common.database")}:`}</span>- {validDatabase ? (- <div- class="normal-link hover:underline cursor-pointer"- onClick={() => {- const query: Record<string, string> = {};- if (access.databaseResource?.schema) {- query.schema = access.databaseResource.schema;- }- if (access.databaseResource?.table) {- query.table = access.databaseResource.table;- }- router.push({- ...autoDatabaseRoute(database),- query,- });- }}- >- <DatabaseV1Name database={database} link={false} />- </div>- ) : (- <div class="flex items-center gap-x-1">- <span class="line-through">+ <NEllipsis>+ {hasGetDatabasePermission.value ? (+ <div+ class="normal-link hover:underline cursor-pointer"+ onClick={() => {+ const query: Record<string, string> = {};+ if (access.databaseResource?.schema) {+ query.schema = access.databaseResource.schema;+ }+ if (access.databaseResource?.table) {+ query.table = access.databaseResource.table;+ }+ router.push({+ path: access.databaseResource?.databaseFullName,+ query,+ });+ }}+ >{access.databaseResource.databaseFullName}- </span>- {!isValidDatabaseResource(access) && (- <NTooltip>- {{- trigger: () => <InfoIcon class="w-4 text-red-600" />,- default: () => t("database.not-found"),- }}- </NTooltip>- )}- </div>- )}+ </div>+ ) : (+ <div class="flex items-center gap-x-1">+ {access.databaseResource.databaseFullName}+ </div>+ )}+ </NEllipsis></div>{access.databaseResource.schema && (<div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 2b43edfd55..8898a619b0 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1739,8 +1739,7 @@"invalid-version-format": "Version must be numeric parts separated by dots (e.g., 1.0.0)","version-already-exists": "This version already exists in the database","delete-confirm-dialog": "This will delete these applied revisions and the database schema will not be changed. This action cannot be undone."- },- "not-found": "Cannot found the database"+ }},"project": {"filter-projects": "Filter projects",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 2161a333e0..238ab227eb 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1739,8 +1739,7 @@"invalid-version-format": "La versión debe tener partes numéricas separadas por puntos (por ejemplo, 1.0.0)","version-already-exists": "Esta versión ya existe en la base de datos","delete-confirm-dialog": "Esto eliminará las revisiones aplicadas y el esquema de la base de datos no se modificará. Esta acción no se puede deshacer."- },- "not-found": "No se puede encontrar la base de datos"+ }},"project": {"filter-projects": "Filtrar proyectos",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 746ab18fcd..1afe285cee 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1739,8 +1739,7 @@"invalid-version-format": "バージョンはドットで区切られた数字部分でなければなりません(例:1.0.0)","version-already-exists": "このバージョンは既にデータベースに存在します","delete-confirm-dialog": "これにより、適用されたリビジョンが削除され、データベース スキーマは変更されません。このアクションは元に戻せません。"- },- "not-found": "データベースが見つかりません"+ }},"project": {"filter-projects": "プロジェクトをフィルタリング",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 5ecb40201d..b41f2504bd 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -1739,8 +1739,7 @@"invalid-version-format": "Phiên bản phải là các phần số được phân tách bằng dấu chấm (ví dụ: 1.0.0)","version-already-exists": "Phiên bản này đã tồn tại trong cơ sở dữ liệu","delete-confirm-dialog": "Thao tác này sẽ xóa các bản sửa đổi đã áp dụng này và lược đồ cơ sở dữ liệu sẽ không bị thay đổi. Hành động này không thể hoàn tác."- },- "not-found": "Không tìm thấy cơ sở dữ liệu"+ }},"project": {"filter-projects": "Lọc dự án",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 312e29dca3..d0449f772c 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1739,8 +1739,7 @@"invalid-version-format": "版本必须是用点分隔的数字部分(例如,1.0.0)","version-already-exists": "此版本已存在于数据库中","delete-confirm-dialog": "这将删除这些已应用的修改,但不会影响数据库 Schema。此操作无法撤消。"- },- "not-found": "找不到数据库"+ }},"project": {"filter-projects": "过滤项目",