Skip to content

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

chore: update setting permission check (#10372)

ecmadao6381b3d0c948
diff --git a/frontend/src/layouts/BodyLayout.vue b/frontend/src/layouts/BodyLayout.vue
index 7e9273db75..255af19d2a 100644
--- a/frontend/src/layouts/BodyLayout.vue
+++ b/frontend/src/layouts/BodyLayout.vue
@@ -194,14 +194,14 @@
>
<QuickActionPanel
:quick-action-list="quickActionList"
- class="flex-1 pt-3"
+ class="flex-1 pt-4"
/>
</div>
</div>
</div>
</HideInStandaloneMode>
<!-- This area may scroll -->
- <div id="bb-layout-main" class="md:min-w-0 flex-1 overflow-y-auto mt-4">
+ <div id="bb-layout-main" class="md:min-w-0 flex-1 overflow-y-auto pt-4">
<!-- Start main area-->
<router-view name="content" />
<!-- End main area -->
diff --git a/frontend/src/layouts/SettingLayout.vue b/frontend/src/layouts/SettingLayout.vue
index 1a31093822..914a708564 100644
--- a/frontend/src/layouts/SettingLayout.vue
+++ b/frontend/src/layouts/SettingLayout.vue
@@ -1,11 +1,12 @@
<template>
- <div class="p-6">
- <router-view />
+ <div class="px-6 pb-6 pt-2">
+ <router-view v-if="hasPermission" />
+ <NoPermissionPlaceholder v-else />
</div>
</template>
<script lang="ts" setup>
-import { computed, onMounted, watch } from "vue";
+import { computed } from "vue";
import { useRouter } from "vue-router";
import { useCurrentUserV1 } from "@/store";
import { hasWorkspacePermissionV2 } from "@/utils";
@@ -24,21 +25,4 @@ const hasPermission = computed(() => {
hasWorkspacePermissionV2(currentUser.value, permission)
);
});
-
-onMounted(() => {});
-
-watch(
- () => hasPermission.value,
- (hasPermission) => {
- if (!hasPermission) {
- router.push({
- name: "error.403",
- replace: false,
- });
- }
- },
- {
- immediate: true,
- }
-);
</script>
diff --git a/frontend/src/router/dashboard/workspaceSetting.ts b/frontend/src/router/dashboard/workspaceSetting.ts
index 2db4ba2669..cd44960705 100644
--- a/frontend/src/router/dashboard/workspaceSetting.ts
+++ b/frontend/src/router/dashboard/workspaceSetting.ts
@@ -104,9 +104,7 @@ const workspaceSettingRoutes: RouteRecordRaw[] = [
name: SETTING_ROUTE_WORKSPACE_SSO,
meta: {
title: () => t("settings.sidebar.sso"),
- requiredWorkspacePermissionList: () => [
- "bb.identityProviders.create",
- ],
+ requiredWorkspacePermissionList: () => ["bb.identityProviders.get"],
},
component: () => import("@/views/SettingWorkspaceSSO.vue"),
},
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index 5501f235b5..38e7f4365e 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -142,7 +142,7 @@ const onClickSearchButton = () => {
const { currentPlan } = storeToRefs(subscriptionStore);
const hasSetSettingPermission = computed(() => {
- return hasWorkspacePermissionV2(currentUser.value, "bb.settings.set");
+ return hasWorkspacePermissionV2(currentUser.value, "bb.settings.get");
});
const kbarActions = computed(() => {
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 319486e1ce..7fe3f5641a 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -57,10 +57,6 @@ const route = useRoute();
const router = useRouter();
const currentUser = useCurrentUserV1();
-const hasSettingListPermission = computed(() => {
- return hasWorkspacePermissionV2(currentUser.value, "bb.settings.set");
-});
-
const getItemClass = (item: SidebarItem) => {
const list = [];
if (route.name === item.name) {
@@ -133,7 +129,6 @@ const settingSidebarItemList = computed((): SidebarItem[] => {
{
title: t("settings.sidebar.members"),
name: SETTING_ROUTE_WORKSPACE_MEMBER,
- hide: !hasSettingListPermission.value,
type: "route",
},
{
@@ -149,7 +144,6 @@ const settingSidebarItemList = computed((): SidebarItem[] => {
{
title: t("settings.sidebar.debug-log"),
name: SETTING_ROUTE_WORKSPACE_DEBUG_LOG,
- hide: !hasSettingListPermission.value,
type: "route",
},
],
@@ -187,19 +181,16 @@ const settingSidebarItemList = computed((): SidebarItem[] => {
{
title: t("settings.sidebar.sensitive-data"),
name: SETTING_ROUTE_WORKSPACE_SENSITIVE_DATA,
- hide: !hasSettingListPermission.value,
type: "route",
},
{
title: t("settings.sidebar.access-control"),
name: SETTING_ROUTE_WORKSPACE_ACCESS_CONTROL,
- hide: !hasSettingListPermission.value,
type: "route",
},
{
title: t("settings.sidebar.audit-log"),
name: SETTING_ROUTE_WORKSPACE_AUDIT_LOG,
- hide: !hasSettingListPermission.value,
type: "route",
},
],
@@ -212,19 +203,16 @@ const settingSidebarItemList = computed((): SidebarItem[] => {
{
title: t("settings.sidebar.gitops"),
name: SETTING_ROUTE_WORKSPACE_GITOPS,
- hide: !hasSettingListPermission.value,
type: "route",
},
{
title: t("settings.sidebar.sso"),
name: SETTING_ROUTE_WORKSPACE_SSO,
- hide: !hasSettingListPermission.value,
type: "route",
},
{
title: t("settings.sidebar.mail-delivery"),
name: SETTING_ROUTE_WORKSPACE_MAIL_DELIVERY,
- hide: !hasSettingListPermission.value,
type: "route",
},
],
@@ -238,8 +226,8 @@ const settingSidebarItemList = computed((): SidebarItem[] => {
];
const checkSidebarItemPermission = (item: SidebarItem) => {
- if (item.path) {
- item.hide = !hasRoutePermission(item.path as string);
+ if (item.name) {
+ item.hide = !hasRoutePermission(item.name);
}
if (item.children) {
item.children.forEach((child) => {