Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: support classification level in masking exemption policy (#19728)
Danny Xu555376aafe7e
diff --git a/backend/api/v1/masking_evaluator.go b/backend/api/v1/masking_evaluator.goindex ffdb4778b7..0292cc7c38 100644--- a/backend/api/v1/masking_evaluator.go+++ b/backend/api/v1/masking_evaluator.go@@ -113,7 +113,9 @@ func (m *maskingLevelEvaluator) evaluateSemanticTypeOfColumn(}if eval != nil && eval.SemanticTypeID != "" {- pass, err := evaluateExemptionOfColumn(databaseMessage, schemaName, tableName, columnName, filteredMaskingExemptions)+ dataClassificationConfig := m.getDataClassificationConfig(databaseProjectDataClassificationID)+ classificationLevel := getClassificationLevelOfColumn(columnConfig.GetClassification(), dataClassificationConfig)+ pass, err := evaluateExemptionOfColumn(databaseMessage, schemaName, tableName, columnName, classificationLevel, filteredMaskingExemptions)if err != nil {return nil, err}@@ -187,15 +189,16 @@ func (m *maskingLevelEvaluator) evaluateGlobalMaskingLevelOfColumn(return nil, nil}-func evaluateExemptionOfColumn(databaseMessage *store.DatabaseMessage, schemaName, tableName, columnName string, filteredMaskingExemptions []*storepb.MaskingExemptionPolicy_Exemption) (bool, error) {+func evaluateExemptionOfColumn(databaseMessage *store.DatabaseMessage, schemaName, tableName, columnName string, classificationLevel int32, filteredMaskingExemptions []*storepb.MaskingExemptionPolicy_Exemption) (bool, error) {for _, filteredMaskingExemption := range filteredMaskingExemptions {maskingExemptionAttributes := map[string]any{"resource": map[string]any{- "instance_id": databaseMessage.InstanceID,- "database_name": databaseMessage.DatabaseName,- "schema_name": schemaName,- "table_name": tableName,- "column_name": columnName,+ "instance_id": databaseMessage.InstanceID,+ "database_name": databaseMessage.DatabaseName,+ "schema_name": schemaName,+ "table_name": tableName,+ "column_name": columnName,+ "classification_level": int64(classificationLevel),},"request": map[string]any{"time": time.Now(),diff --git a/backend/api/v1/masking_evaluator_test.go b/backend/api/v1/masking_evaluator_test.goindex 4d809bf3aa..bfc1eacdfb 100644--- a/backend/api/v1/masking_evaluator_test.go+++ b/backend/api/v1/masking_evaluator_test.go@@ -142,6 +142,68 @@ func TestEvalMaskingLevelOfColumn(t *testing.T) {want: "",},+ {+ description: "Exemption By Classification Level",+ databaseMessage: defaultDatabaseMessage,+ schemaName: "hiring",+ tableName: "employees",+ columnName: "salary",+ columnCatalog: &storepb.ColumnCatalog{+ Classification: "1-1-1",+ },+ maskingRulePolicy: &storepb.MaskingRulePolicy{+ Rules: []*storepb.MaskingRulePolicy_MaskingRule{+ {+ Condition: &expr.Expr{Expression: `resource.classification_level == 2`},+ SemanticType: "default",+ },+ },+ },+ filteredMaskingExemptions: []*storepb.MaskingExemptionPolicy_Exemption{+ {+ Condition: &expr.Expr{+ Expression: `resource.classification_level <= 3`,+ },+ Members: []string{"users/1234"},+ },+ },+ dataClassification: defaultClassification,+ databaseProjectDatabaseClassificationID: defaultProjectDatabaseDataClassificationID,++ want: "",+ },+ {+ description: "Exemption By Classification Level Not Matched",+ databaseMessage: defaultDatabaseMessage,+ schemaName: "hiring",+ tableName: "employees",+ columnName: "salary",+ columnCatalog: &storepb.ColumnCatalog{+ Classification: "1-1-1",+ },+ maskingRulePolicy: &storepb.MaskingRulePolicy{+ Rules: []*storepb.MaskingRulePolicy_MaskingRule{+ {+ Condition: &expr.Expr{Expression: `resource.classification_level == 2`},+ SemanticType: "default",+ },+ },+ },+ filteredMaskingExemptions: []*storepb.MaskingExemptionPolicy_Exemption{+ {+ Condition: &expr.Expr{+ Expression: `resource.classification_level <= 1`,+ },+ Members: []string{"users/1234"},+ },+ },+ dataClassification: defaultClassification,+ databaseProjectDatabaseClassificationID: defaultProjectDatabaseDataClassificationID,++ want: "default",+ wantAlgorithm: "Full mask",+ wantClassLevel: 2,+ },{description: "Column Catalog",databaseMessage: defaultDatabaseMessage,diff --git a/backend/common/cel.go b/backend/common/cel.goindex 178fa2a80e..fa283a6f49 100644--- a/backend/common/cel.go+++ b/backend/common/cel.go@@ -99,6 +99,7 @@ var MaskingExemptionPolicyCELAttributes = []cel.EnvOption{cel.Variable(CELAttributeResourceTableName, cel.StringType),cel.Variable(CELAttributeResourceSchemaName, cel.StringType),cel.Variable(CELAttributeResourceColumnName, cel.StringType),+ cel.Variable(CELAttributeResourceClassificationLevel, cel.IntType),cel.Variable(CELAttributeRequestTime, cel.TimestampType),cel.ParserExpressionSizeLimit(celLimit),}diff --git a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vue b/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vueindex 72772412a8..7f241a5053 100644--- a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vue+++ b/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vue@@ -62,6 +62,7 @@ import { computed, reactive, watch } from "vue";import ExprEditor from "@/components/ExprEditor";import { type OptionConfig } from "@/components/ExprEditor/context";import { FeatureBadge, FeatureModal } from "@/components/FeatureGuard";+import { getClassificationLevelOptions } from "@/components/SensitiveData/components/utils";import type { ConditionGroupExpr, Factor, Operator } from "@/plugins/cel";import {buildCELExpr,@@ -78,6 +79,7 @@ import {getDatabaseNameOptionConfig,} from "@/utils";import {+ CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME,CEL_ATTRIBUTE_RESOURCE_DATABASE,CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,@@ -105,10 +107,12 @@ const props = withDefaults(projectName: string;requiredFeature: PlanFeature;includeCloumn: boolean;+ includeClassificationLevel?: boolean;databaseResources?: DatabaseResource[];}>(),{disabled: false,+ includeClassificationLevel: false,databaseResources: undefined,});@@ -214,6 +218,9 @@ const factorList = computed((): Factor[] => {if (props.includeCloumn) {list.push(CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME);}+ if (props.includeClassificationLevel) {+ list.push(CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL);+ }return list;});@@ -222,16 +229,24 @@ const factorOperatorOverrideMap = new Map<Factor, Operator[]>([[CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME, ["_==_"]],[CEL_ATTRIBUTE_RESOURCE_TABLE_NAME, ["_==_", "@in"]],[CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME, ["_==_", "@in"]],+ [+ CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,+ ["_==_", "_!=_", "_<_", "_<=_", "_>=_", "_>_"],+ ],]);const factorOptionConfigMap = computed((): Map<Factor, OptionConfig> => {return factorList.value.reduce((map, factor) => {- if (factor !== CEL_ATTRIBUTE_RESOURCE_DATABASE) {+ if (factor === CEL_ATTRIBUTE_RESOURCE_DATABASE) {+ map.set(factor, getDatabaseNameOptionConfig(props.projectName));+ } else if (factor === CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL) {map.set(factor, {- options: [],+ options: getClassificationLevelOptions(),});} else {- map.set(factor, getDatabaseNameOptionConfig(props.projectName));+ map.set(factor, {+ options: [],+ });}return map;}, new Map<Factor, OptionConfig>());@@ -250,6 +265,12 @@ defineExpose({return undefined;}},+ getExpr: () => {+ if (state.radioValue !== "EXPRESSION") {+ return undefined;+ }+ return state.expr;+ },isValid: computed(() => {switch (state.radioValue) {case "SELECT":@@ -260,5 +281,6 @@ defineExpose({return true;}}),+ isExpression: computed(() => state.radioValue === "EXPRESSION"),});</script>diff --git a/frontend/src/components/SensitiveData/GrantAccessForm.vue b/frontend/src/components/SensitiveData/GrantAccessForm.vueindex 430eefcc35..71dc06f174 100644--- a/frontend/src/components/SensitiveData/GrantAccessForm.vue+++ b/frontend/src/components/SensitiveData/GrantAccessForm.vue@@ -15,6 +15,7 @@:project-name="projectName":required-feature="PlanFeature.FEATURE_DATA_MASKING":include-cloumn="true"+ :include-classification-level="true"/></div>@@ -77,13 +78,14 @@<script lang="tsx" setup>import { create } from "@bufbuild/protobuf";import { NButton, NDatePicker, NInput } from "naive-ui";-import { computed, reactive, ref } from "vue";+import { computed, onMounted, reactive, ref } from "vue";import { useI18n } from "vue-i18n";import MembersBindingSelect from "@/components/Member/MembersBindingSelect.vue";import RequiredStar from "@/components/RequiredStar.vue";import DatabaseResourceForm from "@/components/RoleGrantPanel/DatabaseResourceForm/index.vue";import FormLayout from "@/components/v2/Form/FormLayout.vue";-import { pushNotification, usePolicyV1Store } from "@/store";+import { buildCELExpr } from "@/plugins/cel";+import { pushNotification, usePolicyV1Store, useSettingV1Store } from "@/store";import { ExprSchema } from "@/types/proto-es/google/type/expr_pb";import type {MaskingExemptionPolicy_Exemption,@@ -95,7 +97,9 @@ import {PolicyResourceType,PolicyType,} from "@/types/proto-es/v1/org_policy_service_pb";+import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";+import { batchConvertParsedExprToCELString } from "@/utils";import type { SensitiveColumn } from "./types";import {convertSensitiveColumnToDatabaseResource,@@ -110,6 +114,14 @@ const props = defineProps<{const emit = defineEmits(["dismiss"]);+const settingStore = useSettingV1Store();+onMounted(async () => {+ await settingStore.getOrFetchSettingByName(+ Setting_SettingName.DATA_CLASSIFICATION,+ true+ );+});+interface LocalState {memberList: string[];expirationTimestamp?: number;@@ -175,34 +187,58 @@ const getPendingUpdatePolicy = async (): Promise<Partial<Policy>> => {const exemptions: MaskingExemptionPolicy_Exemption[] = [];- const expressions = [];+ const extraExpressions: string[] = [];if (state.expirationTimestamp) {- expressions.push(+ extraExpressions.push(`request.time < timestamp("${new Date(state.expirationTimestamp).toISOString()}")`);}- const databaseResources =- await databaseResourceFormRef.value?.getDatabaseResources();+ // When using CEL expression mode, build the expression string directly+ // to preserve non-resource conditions like resource.classification_level.+ const expr = databaseResourceFormRef.value?.getExpr?.();+ if (expr) {+ const parsedExpr = await buildCELExpr(expr);+ if (parsedExpr) {+ const [celString] = await batchConvertParsedExprToCELString([parsedExpr]);+ const parts = [celString, ...extraExpressions].filter((e) => e);+ exemptions.push(+ create(MaskingExemptionPolicy_ExemptionSchema, {+ members: state.memberList,+ condition: create(ExprSchema, {+ description: state.description,+ expression: parts.length > 0 ? parts.join(" && ") : "",+ }),+ })+ );+ }+ } else {+ // ALL or SELECT mode: use database resource conversion+ const databaseResources =+ await databaseResourceFormRef.value?.getDatabaseResources();- const resourceExpressions = databaseResources?.map(- getExpressionsForDatabaseResource- ) ?? [[""]];- for (const expressionList of resourceExpressions) {- const resourceExpression = [...expressionList, ...expressions].filter(- (e) => e- );+ const resourceExpressions = (+ databaseResources?.map(getExpressionsForDatabaseResource) ?? [[""]]+ ).map((parts) => parts.filter((e) => e).join(" && "));++ // Combine multiple resources with || into a single condition.+ let resourceCondition = "";+ const nonEmpty = resourceExpressions.filter((e) => e);+ if (nonEmpty.length === 1) {+ resourceCondition = nonEmpty[0];+ } else if (nonEmpty.length > 1) {+ resourceCondition = nonEmpty.map((e) => `(${e})`).join(" || ");+ }++ const parts = [resourceCondition, ...extraExpressions].filter((e) => e);exemptions.push(create(MaskingExemptionPolicy_ExemptionSchema, {members: state.memberList,condition: create(ExprSchema, {description: state.description,- expression:- resourceExpression.length > 0- ? resourceExpression.join(" && ")- : "",+ expression: parts.length > 0 ? parts.join(" && ") : "",}),}));diff --git a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vueindex 614d306aef..2b3fdd8b49 100644--- a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue+++ b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue@@ -8,7 +8,6 @@:striped="true":loading="!ready || state.loading":max-height="'calc(100vh - 15rem)'"- :scroll-x="scrollX"virtual-scroll/></template>@@ -34,7 +33,7 @@ import {usePolicyByParentAndType,usePolicyV1Store,} from "@/store";-import { groupBindingPrefix } from "@/types";+import { type DatabaseResource, 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 {@@ -89,66 +88,79 @@ const filteredList = computed(() =>state.rawAccessList.filter(props.filterAccessUser));-const getDatabaseAccessResource = (access: AccessUser): VNodeChild => {- if (!access.databaseResource) {- return <div class="textinfo">{t("database.all")}</div>;- }-+const renderDatabaseResource = (res: DatabaseResource): VNodeChild => {return (- <div class="flex flex-col gap-y-1">- <div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">+ <div class="flex flex-col gap-y-0.5 text-sm textinfo">+ <div class="flex items-center gap-x-1"><span class="font-medium">{`${t("common.database")}:`}</span>- <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}- </div>- ) : (- <div class="flex items-center gap-x-1">- {access.databaseResource.databaseFullName}- </div>- )}- </NEllipsis>+ {hasGetDatabasePermission.value ? (+ <span+ class="normal-link hover:underline cursor-pointer"+ onClick={() => {+ const query: Record<string, string> = {};+ if (res.schema) query.schema = res.schema;+ if (res.table) query.table = res.table;+ router.push({ path: res.databaseFullName, query });+ }}+ >+ {res.databaseFullName}+ </span>+ ) : (+ <span>{res.databaseFullName}</span>+ )}</div>- {access.databaseResource.schema && (- <div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">+ {res.schema && (+ <div class="flex items-center gap-x-1"><span class="font-medium">{`${t("common.schema")}:`}</span>- <span>{access.databaseResource.schema}</span>+ <span>{res.schema}</span></div>)}- {access.databaseResource.table && (- <div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">+ {res.table && (+ <div class="flex items-center gap-x-1"><span class="font-medium">{`${t("common.table")}:`}</span>- <span>{access.databaseResource.table}</span>+ <span>{res.table}</span></div>)}- {access.databaseResource.columns &&- access.databaseResource.columns.length > 0 && (- <div class="flex flex-col xl:flex-row xl:items-center gap-x-1 text-sm textinfo">- <span class="font-medium">{`${t("database.columns")}:`}</span>- <span>{access.databaseResource.columns.join(", ")}</span>- </div>- )}+ {res.columns && res.columns.length > 0 && (+ <div class="flex items-center gap-x-1">+ <span class="font-medium">{`${t("database.columns")}:`}</span>+ <span>{res.columns.join(", ")}</span>+ </div>+ )}+ </div>+ );+};++const getConditionDisplay = (access: AccessUser): VNodeChild => {+ if (!access.databaseResources) {+ // No parseable database resources — show raw CEL or "All".+ if (access.conditionExpression) {+ return (+ <NEllipsis class="text-sm font-mono textinfo">+ {access.conditionExpression}+ </NEllipsis>+ );+ }+ return <div class="textinfo">{t("database.all")}</div>;+ }++ return (+ <div class="flex flex-col gap-y-2">+ {access.databaseResources.map((res) => renderDatabaseResource(res))}</div>);};-const expirationTimeRegex = /request.time < timestamp\("(.+)?"\)/;+const expirationTimeRegex = /request\.time\s*<\s*timestamp\("(.+)?"\)/;++// Extract the condition portion of a CEL expression, excluding request.time.+const getConditionExpression = (expression: string): string => {+ if (!expression) return "";+ return expression+ .split(" && ")+ .filter((part) => !part.match(expirationTimeRegex))+ .join(" && ");+};const getAccessUsers = (exception: MaskingExemptionPolicy_Exemption,@@ -162,6 +174,8 @@ const getAccessUsers = (expirationTimestamp = new Date(matches[1]).getTime();}+ const conditionExpression = getConditionExpression(expression);+const result: AccessUser[] = [];for (const member of exception.members) {const access: AccessUser = {@@ -171,9 +185,11 @@ const getAccessUsers = (expirationTimestamp,rawExpression: expression,description,- databaseResource: condition.databaseResources- ? condition.databaseResources[0]- : undefined,+ databaseResources:+ condition.databaseResources && condition.databaseResources.length > 0+ ? condition.databaseResources+ : undefined,+ conditionExpression,};result.push(access);@@ -229,14 +245,13 @@ const accessTableColumns = computed(expandable: (_: AccessUser) => true,hide: props.showDatabaseColumn,renderExpand: (item: AccessUser) => {- return getDatabaseAccessResource(item);+ return getConditionDisplay(item);},},{key: "member",title: t("common.members"),- minWidth: 140,- resizable: true,+ width: 180,render: (item: AccessUser) => {if (item.member.startsWith(groupBindingPrefix)) {const group = groupStore.getGroupByIdentifier(item.member);@@ -251,19 +266,17 @@ const accessTableColumns = computed(},},{- key: "resource",- title: t("common.resource"),- minWidth: 200,- resizable: true,+ key: "condition",+ title: t("cel.condition.self"),hide: !props.showDatabaseColumn,render: (item: AccessUser) => {- return getDatabaseAccessResource(item);+ return getConditionDisplay(item);},},{key: "expire",title: t("common.expiration"),- minWidth: 200,+ width: 220,render: (item: AccessUser) => {return (<NDatePicker@@ -287,7 +300,7 @@ const accessTableColumns = computed({key: "reason",title: t("common.reason"),- minWidth: 120,+ width: 120,render: (item: AccessUser) => {return item.description;},@@ -315,12 +328,6 @@ const accessTableColumns = computed(});-const scrollX = computed(() => {- return accessTableColumns.value.reduce((sum, col) => {- return sum + ((col as { minWidth?: number }).minWidth ?? 100);- }, 0);-});-const revokeAccessAlert = (item: AccessUser) => {$dialog.warning({title: t("common.warning"),@@ -332,7 +339,7 @@ const revokeAccessAlert = (item: AccessUser) => {member: item.member,})}</div>- {getDatabaseAccessResource(item)}+ {getConditionDisplay(item)}</div>);},diff --git a/frontend/src/components/SensitiveData/types.ts b/frontend/src/components/SensitiveData/types.tsindex 518dc29e82..edcf316014 100644--- a/frontend/src/components/SensitiveData/types.ts+++ b/frontend/src/components/SensitiveData/types.ts@@ -31,5 +31,8 @@ export interface AccessUser {expirationTimestamp?: number;rawExpression: string;description: string;- databaseResource?: DatabaseResource;+ databaseResources?: DatabaseResource[];+ // The condition portion of the CEL expression, excluding request.time.+ // Used as fallback display when databaseResources can't be parsed.+ conditionExpression: string;}diff --git a/frontend/src/components/SensitiveData/utils.ts b/frontend/src/components/SensitiveData/utils.tsindex efe4158e37..95e7c012b8 100644--- a/frontend/src/components/SensitiveData/utils.ts+++ b/frontend/src/components/SensitiveData/utils.ts@@ -4,6 +4,7 @@ import type { MaskingExemptionPolicy_Exemption } from "@/types/proto-es/v1/org_pimport { extractDatabaseResourceName } from "@/utils";import {CEL_ATTRIBUTE_REQUEST_TIME,+ CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME,CEL_ATTRIBUTE_RESOURCE_DATABASE_NAME,CEL_ATTRIBUTE_RESOURCE_INSTANCE_ID,@@ -36,7 +37,11 @@ export const isCurrentColumnException = (}const databaseExpression = expression.split(" && ")- .filter((expr) => !expr.startsWith(CEL_ATTRIBUTE_REQUEST_TIME))+ .filter(+ (expr) =>+ !expr.startsWith(CEL_ATTRIBUTE_REQUEST_TIME) &&+ !expr.startsWith(CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL)+ ).join(" && ");const matches = getExpressionsForDatabaseResource(convertSensitiveColumnToDatabaseResource(sensitiveColumn)diff --git a/frontend/src/components/TableDataTable.vue b/frontend/src/components/TableDataTable.vueindex f377b72260..47f48ea8d4 100644--- a/frontend/src/components/TableDataTable.vue+++ b/frontend/src/components/TableDataTable.vue@@ -46,6 +46,7 @@ import type {Database,TableMetadata,} from "@/types/proto-es/v1/database_service_pb";+import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import {bytesToString,@@ -80,11 +81,15 @@ const router = useRouter();const state = reactive<LocalState>({});const settingStore = useSettingV1Store();-onMounted(() => {+onMounted(async () => {const table = route.query.table as string;if (table) {state.selectedTableName = table;}+ await settingStore.getOrFetchSettingByName(+ Setting_SettingName.DATA_CLASSIFICATION,+ true+ );});watch(diff --git a/frontend/src/views/project/ProjectMaskingExemption.vue b/frontend/src/views/project/ProjectMaskingExemption.vueindex 31ce3317cc..5afa6a3a03 100644--- a/frontend/src/views/project/ProjectMaskingExemption.vue+++ b/frontend/src/views/project/ProjectMaskingExemption.vue@@ -129,11 +129,11 @@ const filterAccessUser = (user: AccessUser): boolean => {return false;}if (state.selectedDatabaseName) {- if (!user.databaseResource) {+ if (!user.databaseResources) {return true;}- return (- user.databaseResource.databaseFullName === state.selectedDatabaseName+ return user.databaseResources.some(+ (r) => r.databaseFullName === state.selectedDatabaseName);}