Skip to content

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

fix: check permission for creating project button (#13733)

boojackfa375b2d4fee
diff --git a/frontend/src/components/Project/ProjectSwitchModal.vue b/frontend/src/components/Project/ProjectSwitchModal.vue
index 9bc17b3a19..bc00c6a2e2 100644
--- a/frontend/src/components/Project/ProjectSwitchModal.vue
+++ b/frontend/src/components/Project/ProjectSwitchModal.vue
@@ -37,7 +37,7 @@
class="!w-40"
size="small"
/>
- <NTooltip trigger="hover">
+ <NTooltip v-if="allowToCreateProject" trigger="hover">
<template #trigger>
<NButton size="small" @click="state.showCreateDrawer = true">
<template #icon>
@@ -102,7 +102,10 @@ import { useProjectV1List } from "@/store";
import { getProjectName } from "@/store/modules/v1/common";
import type { ComposedProject } from "@/types";
import { isValidProjectName, DEFAULT_PROJECT_NAME } from "@/types";
-import { filterProjectV1ListByKeyword } from "@/utils";
+import {
+ filterProjectV1ListByKeyword,
+ hasWorkspacePermissionV2,
+} from "@/utils";
import ProjectCreatePanel from "./ProjectCreatePanel.vue";
interface LocalState {
@@ -151,6 +154,10 @@ const filteredAllProjectList = computed(() => {
return getFilteredProjectList(projectList.value);
});
+const allowToCreateProject = computed(() =>
+ hasWorkspacePermissionV2("bb.projects.create")
+);
+
const tabList = computed(() => [
{
title: t("common.recent"),