Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: hide export center in dashboard sidebar (#10446)

boojack99e1ff28d84e
diff --git a/frontend/src/utils/iam/permission.ts b/frontend/src/utils/iam/permission.ts
index 46d43b8c44..bbd9cc480a 100644
--- a/frontend/src/utils/iam/permission.ts
+++ b/frontend/src/utils/iam/permission.ts
@@ -23,11 +23,20 @@ export const hasWorkspacePermissionV2 = (
return permissions.includes(permission);
};
+// hasProjectPermissionV2 checks if the user has the given permission on the project.
export const hasProjectPermissionV2 = (
- project: ComposedProject,
+ project: ComposedProject | undefined,
user: User,
permission: ProjectPermission
): boolean => {
+ // If the project is not provided, then check if the user has the given permission on any project in the workspace.
+ if (!project) {
+ const { projectList } = useProjectV1ListByUser(user);
+ return projectList.value.some((project) =>
+ hasProjectPermissionV2(project, user, permission)
+ );
+ }
+
const roleStore = useRoleStore();
const actuatorStore = useActuatorV1Store();
const isDevelopmentIAM = actuatorStore.serverInfo?.iamGuard;
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index c11b964424..00fa398f46 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -36,7 +36,7 @@ import {
WORKSPACE_ROUTE_ANOMALY_CENTER,
} from "@/router/dashboard/workspaceRoutes";
import { useCurrentUserV1 } from "@/store";
-import { hasWorkspacePermissionV2 } from "../utils";
+import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "../utils";
interface DashboardSidebarItem extends SidebarItem {
navigationId: string;
@@ -131,6 +131,11 @@ const dashboardSidebarItemList = computed((): DashboardSidebarItem[] => {
name: WORKSPACE_ROUTE_EXPORT_CENTER,
type: "route",
shortcuts: ["g", "x", "c"],
+ hide: !hasProjectPermissionV2(
+ undefined,
+ currentUserV1.value,
+ "bb.projects.getIamPolicy"
+ ),
},
{
navigationId: "bb.navigation.anomaly-center",