Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
For team plan, also allow Developer role to access instance.
天舟0f8bcc94f918
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex 3e6db5fa39..ad1ef06277 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -240,10 +240,9 @@ input[type="number"] {/></div></div>- <div class="pt-8 space-y-2">+ <div v-if="showTestConnection" class="pt-8 space-y-2"><div class="flex flex-row space-x-2"><button- :disabled="!allowEdit"@click.prevent="testConnection"type="button"class="btn-normal whitespace-nowrap items-center"@@ -403,6 +402,10 @@ export default {);});+ const showTestConnection = computed(() => {+ return props.create || (state.instance as Instance).rowStatus == "NORMAL";+ });+const valueChanged = computed(() => {return (!isEqual(state.instance, state.originalInstance) ||@@ -542,6 +545,7 @@ export default {state,allowCreate,allowEdit,+ showTestConnection,valueChanged,updateInstance,cancel,diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex 909fdc646d..075a72e76e 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -647,14 +647,10 @@ router.beforeEach((to, from, next) => {}const checkRouteAuth = (user: Principal) => {- if (- to.name === "workspace.instance" ||- to.name?.toString().startsWith("setting.workspace.version-control")- ) {+ if (to.name?.toString().startsWith("setting.workspace.version-control")) {if (isDBAOrOwner(user.role)) {next();} else {- console.log("403333", user);next({name: "error.403",replace: false,@@ -663,16 +659,19 @@ router.beforeEach((to, from, next) => {return;}- // Fetching specific instance would try to fetch the sensitive info- // so we short circuit here for non-DBA/Owner to avoid there.- if (to.name?.toString().startsWith("workspace.instance.")) {- if (!isDBAOrOwner(user.role)) {+ if (to.name === "workspace.instance") {+ if (+ !store.getters["plan/feature"]("bb.dba-workflow") ||+ isDBAOrOwner(user.role)+ ) {+ next();+ } else {next({name: "error.403",replace: false,});- return;}+ return;}if (to.name === "workspace.database.create") {diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vueindex 792abe95af..4bb2ddc277 100644--- a/frontend/src/views/DashboardHeader.vue+++ b/frontend/src/views/DashboardHeader.vue@@ -215,7 +215,10 @@ export default {const currentPlan = computed(() => store.getters["plan/currentPlan"]());const showDBAItem = computed((): boolean => {- return isDBAOrOwner(currentUser.value.role);+ return (+ !store.getters["plan/feature"]("bb.dba-workflow") ||+ isDBAOrOwner(currentUser.value.role)+ );});const showSwitchPlan = computed((): boolean => {diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vueindex c61a14640c..db8509184c 100644--- a/frontend/src/views/InstanceDashboard.vue+++ b/frontend/src/views/InstanceDashboard.vue@@ -20,7 +20,7 @@:okText="'Do not show again'":cancelText="'Dismiss'":title="'How to setup \'Instance\' ?'"- :description="'Each instance in Bytebase usually maps to one of your database instance represented by an host:port address. This could be your on-premise MySQL instance, a RDS instance.\n\nBytebase requires read/write (NOT the super privilege) access to the instance in order to perform database operations on behalf of the user.\n\nInstance is only exposed to Owners and DBAs. For the developers, they are interacting directly with the database inside the instance.'"+ :description="'Each instance in Bytebase usually maps to one of your database instance represented by an host:port address. This could be your on-premise MySQL instance, a RDS instance.\n\nBytebase requires read/write (NOT the super privilege) access to the instance in order to perform database operations on behalf of the user.'"@ok="() => {doDismissGuide();diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vueindex f5dad7ffe8..4e89e1cab6 100644--- a/frontend/src/views/InstanceDetail.vue+++ b/frontend/src/views/InstanceDetail.vue@@ -20,38 +20,42 @@<div class="mb-4 flex items-center justify-between"><div class="inline-flex space-x-2"><div class="text-lg leading-6 font-medium text-main">Databases</div>- <BBButtonAdd- v-if="instance.rowStatus == 'NORMAL'"- @add="tryAddDatabase"- />+ <BBButtonAdd v-if="allowEdit" @add="tryAddDatabase" /></div>- <button type="button" class="btn-normal" @click.prevent="syncSchema">+ <button+ v-if="allowEdit"+ type="button"+ class="btn-normal"+ @click.prevent="syncSchema"+ >Sync Now</button></div><DatabaseTable :mode="'INSTANCE'" :databaseList="databaseList" /></div>- <template v-if="instance.rowStatus == 'NORMAL'">- <BBButtonConfirm- :style="'ARCHIVE'"- :buttonText="'Archive this instance'"- :okText="'Archive'"- :requireConfirm="true"- :confirmTitle="`Archive instance '${instance.name}'?`"- :confirmDescription="'Archived instsance will not be shown on the normal interface. You can still restore later from the Archive page.'"- @confirm="doArchive"- />- </template>- <template v-else-if="instance.rowStatus == 'ARCHIVED'">- <BBButtonConfirm- :style="'RESTORE'"- :buttonText="'Restore this instance'"- :okText="'Restore'"- :requireConfirm="true"- :confirmTitle="`Restore instance '${instance.name}' to normal state?`"- :confirmDescription="''"- @confirm="doRestore"- />+ <template v-if="allowEdit">+ <template v-if="instance.rowStatus == 'NORMAL'">+ <BBButtonConfirm+ :style="'ARCHIVE'"+ :buttonText="'Archive this instance'"+ :okText="'Archive'"+ :requireConfirm="true"+ :confirmTitle="`Archive instance '${instance.name}'?`"+ :confirmDescription="'Archived instsance will not be shown on the normal interface. You can still restore later from the Archive page.'"+ @confirm="doArchive"+ />+ </template>+ <template v-else-if="instance.rowStatus == 'ARCHIVED'">+ <BBButtonConfirm+ :style="'RESTORE'"+ :buttonText="'Restore this instance'"+ :okText="'Restore'"+ :requireConfirm="true"+ :confirmTitle="`Restore instance '${instance.name}' to normal state?`"+ :confirmDescription="''"+ @confirm="doRestore"+ />+ </template></template></div></div>@@ -77,7 +81,7 @@import { computed, reactive, watchEffect } from "vue";import { useRouter } from "vue-router";import { useStore } from "vuex";-import { idFromSlug } from "../utils";+import { idFromSlug, isDBAOrOwner } from "../utils";import ArchiveBanner from "../components/ArchiveBanner.vue";import DatabaseTable from "../components/DatabaseTable.vue";import DataSourceTable from "../components/DataSourceTable.vue";@@ -112,6 +116,8 @@ export default {const router = useRouter();const store = useStore();+ const currentUser = computed(() => store.getters["auth/currentUser"]());+const state = reactive<LocalState>({migrationSetupStatus: "OK",showCreateMigrationSchemaModal: false,@@ -173,6 +179,13 @@ export default {);});+ const allowEdit = computed(() => {+ return (+ instance.value.rowStatus == "NORMAL" &&+ isDBAOrOwner(currentUser.value.role)+ );+ });+const tryAddDatabase = () => {router.push({name: "workspace.database.create",@@ -269,6 +282,7 @@ export default {hasDataSourceFeature,instance,databaseList,+ allowEdit,tryAddDatabase,doArchive,doRestore,diff --git a/server/acl_casbin_policy_developer.csv b/server/acl_casbin_policy_developer.csvindex 0bf7124028..d286fcfdc7 100644--- a/server/acl_casbin_policy_developer.csv+++ b/server/acl_casbin_policy_developer.csv@@ -17,6 +17,8 @@ p, DEVELOPER, /project/{projectId}/member/{memberId}, DELETEp, DEVELOPER, /environment, GETp, DEVELOPER, /instance, GETp, DEVELOPER, /instance/{id}, GET+p, DEVELOPER, /instance/{id}/migration/status, GET+p, DEVELOPER, /instance/{id}, GETp, DEVELOPER, /database, POSTp, DEVELOPER, /database, GETp, DEVELOPER, /database/{id}, GET