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: skip fetch resource if no permission (#13087)
ecmadao02177b95e90e
diff --git a/frontend/src/components/SQLReview/components/SQLReviewAttachedResource.vue b/frontend/src/components/SQLReview/components/SQLReviewAttachedResource.vueindex 88789901ab..66aa8dfc37 100644--- a/frontend/src/components/SQLReview/components/SQLReviewAttachedResource.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewAttachedResource.vue@@ -14,6 +14,7 @@ import {useDatabaseV1Store,useProjectV1Store,} from "@/store";+import { UNKNOWN_ID } from "@/types";import { useReviewConfigAttachedResource } from "./useReviewConfigAttachedResource";const props = defineProps<{@@ -36,13 +37,16 @@ const reviewPolicyResourceComponent = computed(() => {const environment = environmentV1Store.getEnvironmentByName(props.resource);- if (!environment) {- return;+ if (environment.uid === `${UNKNOWN_ID}`) {+ return <div>{props.resource}</div>;}return <EnvironmentV1Name environment={environment} link={props.link} />;}case "database": {const database = databaseStore.getDatabaseByName(props.resource);+ if (database.uid === `${UNKNOWN_ID}`) {+ return <div>{props.resource}</div>;+ }return (<RichDatabaseNamedatabase={database}@@ -53,6 +57,9 @@ const reviewPolicyResourceComponent = computed(() => {}case "project": {const project = projectStore.getProjectByName(props.resource);+ if (project.uid === `${UNKNOWN_ID}`) {+ return <div>{props.resource}</div>;+ }return (<ProjectNameCell mode="ALL_SHORT" project={project} link={props.link} />);diff --git a/frontend/src/components/SQLReview/components/useReviewConfigAttachedResource.ts b/frontend/src/components/SQLReview/components/useReviewConfigAttachedResource.tsindex 91434225e8..ab09182ea5 100644--- a/frontend/src/components/SQLReview/components/useReviewConfigAttachedResource.ts+++ b/frontend/src/components/SQLReview/components/useReviewConfigAttachedResource.ts@@ -4,12 +4,14 @@ import {useEnvironmentV1Store,useDatabaseV1Store,useProjectV1Store,+ useCurrentUserV1,} from "@/store";import {environmentNamePrefix,projectNamePrefix,isDatabaseName,} from "@/store/modules/v1/common";+import { hasWorkspacePermissionV2 } from "@/utils";export type ResourceType = "environment" | "project" | "database";@@ -17,6 +19,7 @@ export const useReviewConfigAttachedResource = (resource: Ref<string>) => {const environmentV1Store = useEnvironmentV1Store();const databaseStore = useDatabaseV1Store();const projectStore = useProjectV1Store();+ const me = useCurrentUserV1();const resourceType = computed((): ResourceType | undefined => {if (resource.value.startsWith(environmentNamePrefix)) {@@ -43,13 +46,19 @@ export const useReviewConfigAttachedResource = (resource: Ref<string>) => {watchEffect(async () => {switch (resourceType.value) {case "database":- await databaseStore.getOrFetchDatabaseByName(resource.value);+ if (hasWorkspacePermissionV2(me.value, "bb.databases.get")) {+ await databaseStore.getOrFetchDatabaseByName(resource.value);+ }return;case "environment":- await environmentV1Store.getOrFetchEnvironmentByName(resource.value);+ if (hasWorkspacePermissionV2(me.value, "bb.environments.get")) {+ await environmentV1Store.getOrFetchEnvironmentByName(resource.value);+ }return;case "project":- await projectStore.getOrFetchProjectByName(resource.value);+ if (hasWorkspacePermissionV2(me.value, "bb.projects.get")) {+ await projectStore.getOrFetchProjectByName(resource.value);+ }return;}});