Skip to content

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

Only allow workspace owner to access VCS setting pages

天舟ee22e9db5ac1
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 062a69b50e..92f1988701 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -642,7 +642,10 @@ router.beforeEach((to, from, next) => {
}
const loginUser: Principal = store.getters["auth/currentUser"]();
- if (to.name === "workspace.instance") {
+ if (
+ to.name === "workspace.instance" ||
+ to.name?.toString().startsWith("setting.workspace.version-control")
+ ) {
if (isDBAOrOwner(loginUser.role)) {
next();
} else {
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 1fdc4bd8fb..c7245f8ab8 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -128,6 +128,7 @@
Members
</router-link>
<router-link
+ v-if="showOwnerItem"
to="/setting/version-control"
class="outline-item group w-full flex items-center pl-11 pr-2 py-2"
>
@@ -159,7 +160,7 @@
import { computed, reactive } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
-import { isDBAOrOwner } from "../utils";
+import { isOwner } from "../utils";
interface LocalState {
collapseState: boolean;
@@ -184,6 +185,10 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
+ const showOwnerItem = computed((): boolean => {
+ return isOwner(currentUser.value.role);
+ });
+
const goBack = () => {
router.push(store.getters["router/backPath"]());
};
@@ -202,6 +207,7 @@ export default {
return {
state,
integrationList,
+ showOwnerItem,
goBack,
toggleCollapse,
};