Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: update feature matrix to include new paid features and comment the usage (#485)
tianzhou60be8801bd68
diff --git a/api/plan.go b/api/plan.goindex 58f0a8724c..d387dd7cc6 100644--- a/api/plan.go+++ b/api/plan.go@@ -1,29 +1,5 @@package api-// FeatureType is the type of a feature.-type FeatureType string--const (- // FeatureAdmin is the feature type for admin.- FeatureAdmin FeatureType = "bb.admin"- // FeatureDBAWorkflow is the feature type for DBA.- FeatureDBAWorkflow FeatureType = "bb.dba-workflow"- // FeatureDataSource is the feature type for data sources.- FeatureDataSource FeatureType = "bb.data-source"-)--func (e FeatureType) String() string {- switch e {- case FeatureAdmin:- return "bb.admin"- case FeatureDBAWorkflow:- return "bb.dba-workflow"- case FeatureDataSource:- return "bb.data-source"- }- return ""-}-// PlanType is the type for a plan.type PlanType int@@ -49,11 +25,113 @@ func (p PlanType) String() string {return ""}+// FeatureType is the type of a feature.+type FeatureType string++const (+ // Change Workflow++ // FeatureBackwardCompatibilty checks if a DDL change is backward compatible.+ // See https://docs.bytebase.com/features/sql-advisor/backward-compatibility-migration-check+ //+ // Currently, we only support MySQL/TiDB thanks to github.com/pingcap/parser+ FeatureBackwardCompatibilty FeatureType = "bb.feature.backward-compatibility"+ // FeatureSchemaDrift detects if there occurs schema drift.+ // See https://docs.bytebase.com/features/drift-detection+ FeatureSchemaDrift FeatureType = "bb.feature.schema-drift"+ // FeatureTaskScheduleTime allows user to run task at a scheduled time+ FeatureTaskScheduleTime FeatureType = "bb.feature.task-schedule-time"+ // FeatureMultiTenancy allows user to enable tenant mode for the project.+ //+ // Tenant mode allows user to track a group of homogeneous database changes together.+ // e.g. A game studio may deploy many servers, each server is fully isolated with its+ // own database. When a new game version is released, it may require to upgrade the+ // underlying database schema, then tenant mode will help the studio to track the+ // schema change across all databases.+ FeatureMultiTenancy FeatureType = "bb.feature.multi-tenancy"+ // FeatureDBAWorkflow enforces the DBA workflow.+ //+ // - Developers can't create and view instances since they are exclusively by DBA, they can+ // only access database.+ // - Developers can submit troubleshooting issue.+ FeatureDBAWorkflow FeatureType = "bb.feature.dba-workflow"+ // FeatureDataSource exposes the data source concept.+ //+ // Currently, we DO NOT expose this feature.+ //+ // Internally Bytebase stores instance username/password in a seperate data source model.+ // This allows a single instance to have multiple data sources (e.g. one RW and one RO).+ // And from the user's perspective, the username/password+ // look like the property of the instance, which are not. They are the property of data source which+ // in turns belongs to the instance.+ // - Support defining extra data source for a database and exposing the related data source UI.+ FeatureDataSource FeatureType = "bb.feature.data-source"++ // Policy Control++ // FeatureApprovalPolicy allows user to specify approval policy for the environment+ //+ // e.g. One can configure to NOT require approval for dev environment while require+ // manual approval for production.+ FeatureApprovalPolicy FeatureType = "bb.feature.approval-policy"+ // FeatureBackupPolicy allows user to specify backup policy for the environment+ //+ // e.g. One can configure to NOT require backup for dev environment while require+ // weekly backup for staging and daily backup for production.+ FeatureBackupPolicy FeatureType = "bb.feature.backup-policy"++ // Admin & Security++ // FeatureRBAC enables RBAC.+ //+ // - Workspace level RBAC+ // - Project level RBAC+ FeatureRBAC FeatureType = "bb.feature.rbac"++ // Feature3rdPartyLogin allows user to login using 3rd party account.+ //+ // Currently, we only support GitLab EE/CE OAuth login.+ Feature3rdPartyLogin FeatureType = "bb.feature.3rd-party-login"+)++func (e FeatureType) String() string {+ switch e {+ case FeatureBackwardCompatibilty:+ return "bb.feature.backward-compatibility"+ case FeatureSchemaDrift:+ return "bb.feature.schema-drift"+ case FeatureTaskScheduleTime:+ return "bb.feature.task-schedule-time"+ case FeatureMultiTenancy:+ return "bb.feature.multi-tenancy"+ case FeatureDBAWorkflow:+ return "bb.feature.dba-workflow"+ case FeatureDataSource:+ return "bb.feature.data-source"+ case FeatureApprovalPolicy:+ return "bb.feature.approval-policy"+ case FeatureBackupPolicy:+ return "bb.feature.backup-policy"+ case FeatureRBAC:+ return "bb.feature.rbac"+ case Feature3rdPartyLogin:+ return "bb.feature.3rd-party-login"+ }+ return ""+}+// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular planvar FeatureMatrix = map[FeatureType][3]bool{- "bb.admin": {false, true, true},- "bb.dba-workflow": {false, false, true},- "bb.data-source": {false, false, false},+ "bb.feature.backward-compatibility": {false, true, true},+ "bb.feature.schema-drift": {false, true, true},+ "bb.feature.task-schedule-time": {false, true, true},+ "bb.feature.multi-tenancy": {false, true, true},+ "bb.feature.dba-workflow": {false, false, true},+ "bb.feature.data-source": {false, false, false},+ "bb.feature.approval-policy": {false, true, true},+ "bb.feature.backup-policy": {false, true, true},+ "bb.feature.rbac": {false, true, true},+ "bb.feature.3rd-party-login": {false, true, true},}// Plan is the API message for a plan.diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vueindex cde8271e1a..2b947675b1 100644--- a/frontend/src/components/DatabaseOverviewPanel.vue+++ b/frontend/src/components/DatabaseOverviewPanel.vue@@ -3,18 +3,17 @@<div v-if="anomalySectionList.length > 0"><div class="text-lg leading-6 font-medium text-main mb-4 flex flex-row">{{ $t("common.anomalies") }}- <span class="ml-2 textinfolabel items-center flex">{{- $t(- "database.the-list-might-be-out-of-date-and-is-refreshed-roughly-every-10-minutes"- )- }}</span>+ <span class="ml-2 textinfolabel items-center flex">+ {{+ $t(+ "database.the-list-might-be-out-of-date-and-is-refreshed-roughly-every-10-minutes"+ )+ }}+ </span></div><AnomalyTable :anomaly-section-list="anomalySectionList" /></div>- <div- v-else- class="text-lg leading-6 font-medium text-main mb-4 flex flex-row"- >+ <div v-else class="text-lg leading-6 font-medium text-main mb-4 flex flex-row">{{ $t("database.no-anomalies-detected") }}<heroicons-outline:check-circle class="ml-1 w-6 h-6 text-success" /></div>@@ -35,67 +34,43 @@: $t("db.character-set")}}</dt>- <dd class="mt-1 text-sm text-main">- {{ database.characterSet }}- </dd>+ <dd class="mt-1 text-sm text-main">{{ database.characterSet }}</dd></div><div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("db.collation") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ database.collation }}- </dd>+ <dt class="text-sm font-medium text-control-light">{{ $t("db.collation") }}</dt>+ <dd class="mt-1 text-sm text-main">{{ database.collation }}</dd></div></template><div class="col-span-1 col-start-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.sync-status") }}- </dt>+ <dt class="text-sm font-medium text-control-light">{{ $t("database.sync-status") }}</dt><dd class="mt-1 text-sm text-main"><span>{{ database.syncStatus }}</span></dd></div><div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.last-successful-sync") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ humanizeTs(database.lastSuccessfulSyncTs) }}- </dd>+ <dt class="text-sm font-medium text-control-light">{{ $t("database.last-successful-sync") }}</dt>+ <dd class="mt-1 text-sm text-main">{{ humanizeTs(database.lastSuccessfulSyncTs) }}</dd></div><div class="col-span-1 col-start-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("common.created-at") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ humanizeTs(database.createdTs) }}- </dd>+ <dt class="text-sm font-medium text-control-light">{{ $t("common.created-at") }}</dt>+ <dd class="mt-1 text-sm text-main">{{ humanizeTs(database.createdTs) }}</dd></div><div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("common.updated-at") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ humanizeTs(database.updatedTs) }}- </dd>+ <dt class="text-sm font-medium text-control-light">{{ $t("common.updated-at") }}</dt>+ <dd class="mt-1 text-sm text-main">{{ humanizeTs(database.updatedTs) }}</dd></div></dl><div class="pt-6">- <div class="text-lg leading-6 font-medium text-main mb-4">- {{ $t("db.tables") }}- </div>+ <div class="text-lg leading-6 font-medium text-main mb-4">{{ $t("db.tables") }}</div><TableTable :table-list="tableList" />- <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">- {{ $t("db.views") }}- </div>+ <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">{{ $t("db.views") }}</div><ViewTable :view-list="viewList" /></div>@@ -113,42 +88,29 @@:key="index"><div v-if="item.list.length" class="pt-6">- <div- v-if="hasDataSourceFeature"- class="text-lg leading-6 font-medium text-main mb-4"- >+ <div v-if="hasDataSourceFeature" class="text-lg leading-6 font-medium text-main mb-4"><span v-data-source-type>{{ item.type }}</span></div><div class="space-y-4"><div v-for="(ds, dsIndex) of item.list" :key="dsIndex"><div v-if="hasDataSourceFeature" class="relative mb-2">- <div- class="absolute inset-0 flex items-center"- aria-hidden="true"- >+ <div class="absolute inset-0 flex items-center" aria-hidden="true"><div class="w-full border-t border-gray-300"></div></div><div class="relative flex justify-start"><router-link:to="`/db/${databaseSlug}/datasource/${dataSourceSlug(ds)}`"class="pr-3 bg-white font-medium normal-link"- >- {{ ds.name }}- </router-link>+ >{{ ds.name }}</router-link></div></div>- <div- v-if="allowChangeDataSource"- class="flex justify-end space-x-3"- >+ <div v-if="allowChangeDataSource" class="flex justify-end space-x-3"><template v-if="isEditingDataSource(ds)"><buttontype="button"class="btn-normal"@click.prevent="cancelEditDataSource"- >- {{ $t("common.cancel") }}- </button>+ >{{ $t("common.cancel") }}</button><buttontype="button"class="btn-normal"@@ -156,22 +118,14 @@@click.prevent="saveEditDataSource"><!-- Heroicon name: solid/save -->- <heroicons-solid:save- class="-ml-1 mr-2 h-5 w-5 text-control-light"- />+ <heroicons-solid:save class="-ml-1 mr-2 h-5 w-5 text-control-light" /><span>{{ $t("common.save") }}</span></button></template><template v-else>- <button- type="button"- class="btn-normal"- @click.prevent="editDataSource(ds)"- >+ <button type="button" class="btn-normal" @click.prevent="editDataSource(ds)"><!-- Heroicon name: solid/pencil -->- <heroicons-solid:pencil- class="-ml-1 mr-2 h-5 w-5 text-control-light"- />+ <heroicons-solid:pencil class="-ml-1 mr-2 h-5 w-5 text-control-light" /><span>{{ $t("common.edit") }}</span></button></template>@@ -257,7 +211,7 @@ export default {);const hasDataSourceFeature = computed(() =>- store.getters["plan/feature"]("bb.data-source")+ store.getters["plan/feature"]("bb.feature.data-source"));const tableList = computed(() => {diff --git a/frontend/src/components/MemberAddOrInvite.vue b/frontend/src/components/MemberAddOrInvite.vueindex 9fbc228062..065fe7b62c 100644--- a/frontend/src/components/MemberAddOrInvite.vue+++ b/frontend/src/components/MemberAddOrInvite.vue@@ -6,9 +6,7 @@:key="index"class="flex justify-between py-0.5 select-none">- <p id="add_or_invite_members_helper" class="sr-only">- {{ $t("settings.members.helper") }}- </p>+ <p id="add_or_invite_members_helper" class="sr-only">{{ $t("settings.members.helper") }}</p><div class="flex flex-row space-x-4"><div class="flex-grow"><input@@ -26,9 +24,7 @@v-if="state.errorList[index]"id="email-error"class="mt-2 text-sm text-error"- >- {{ state.errorList[index] }}- </p>+ >{{ state.errorList[index] }}</p></div><div v-if="hasAdminFeature" class="sm:hidden w-36"><RoleSelect@@ -54,7 +50,7 @@class="btn"value="OWNER"/>- <label class="label"> {{ $t("common.role.owner") }} </label>+ <label class="label">{{ $t("common.role.owner") }}</label></div><div class="radio"><input@@ -65,7 +61,7 @@class="btn"value="DBA"/>- <label class="label"> {{ $t("common.role.dba") }} </label>+ <label class="label">{{ $t("common.role.dba") }}</label></div><div class="radio"><input@@ -76,7 +72,7 @@class="btn"value="DEVELOPER"/>- <label class="label"> {{ $t("common.role.developer") }} </label>+ <label class="label">{{ $t("common.role.developer") }}</label></div></div></div>@@ -85,9 +81,11 @@<div class="flex justify-between"><span class="flex items-center">- <button type="button" class="btn-secondary" @click.prevent="addUser">- {{ $t("settings.members.add-more") }}- </button>+ <button+ type="button"+ class="btn-secondary"+ @click.prevent="addUser"+ >{{ $t("settings.members.add-more") }}</button></span><button@@ -141,7 +139,7 @@ export default {});const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const state = reactive<LocalState>({diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vueindex 7fede6c02c..1b0d673ab0 100644--- a/frontend/src/components/MemberTable.vue+++ b/frontend/src/components/MemberTable.vue@@ -131,7 +131,7 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const state = reactive<LocalState>({});diff --git a/frontend/src/components/ProjectMemberPanel.vue b/frontend/src/components/ProjectMemberPanel.vueindex 813314e3d6..0382aaf99c 100644--- a/frontend/src/components/ProjectMemberPanel.vue+++ b/frontend/src/components/ProjectMemberPanel.vue@@ -1,15 +1,11 @@<template><div>- <p class="text-lg font-medium leading-7 text-main">- {{ $t("project.settings.manage-member") }}- </p>+ <p class="text-lg font-medium leading-7 text-main">{{ $t("project.settings.manage-member") }}</p><div v-if="allowAddMember" class="mt-4 w-full flex justify-start"><!-- To prevent jiggling when showing the error text --><div :class="state.error ? 'space-y-1' : 'space-y-6'"><div class="space-y-2">- <div- class="flex flex-row justify-between py-0.5 select-none space-x-4"- >+ <div class="flex flex-row justify-between py-0.5 select-none space-x-4"><div class="w-64"><!-- eslint-disable vue/attribute-hyphenation --><MemberSelect@@ -38,7 +34,8 @@class="btn"value="OWNER"/>- {{ $t("common.role.owner") }} </label>+ {{ $t("common.role.owner") }}+ </label></div><div class="radio"><label class="label">@@ -50,7 +47,8 @@class="btn"value="DEVELOPER"/>- {{ $t("common.role.developer") }} </label>+ {{ $t("common.role.developer") }}+ </label></div></div><button@@ -66,9 +64,7 @@</div><div id="state-error" class="flex justify-start">- <span v-if="state.error" class="text-sm text-error">- {{ state.error }}- </span>+ <span v-if="state.error" class="text-sm text-error">{{ state.error }}</span></div></div></div>@@ -121,7 +117,7 @@ export default {});const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const allowAddMember = computed(() => {diff --git a/frontend/src/components/ProjectMemberTable.vue b/frontend/src/components/ProjectMemberTable.vueindex f49205ee47..6b4380d1e0 100644--- a/frontend/src/components/ProjectMemberTable.vue+++ b/frontend/src/components/ProjectMemberTable.vue@@ -8,34 +8,15 @@:row-clickable="false"><template #header>- <BBTableHeaderCell- :left-padding="4"- class="w-auto table-cell"- :title="columnList[0].title"- />+ <BBTableHeaderCell :left-padding="4" class="w-auto table-cell" :title="columnList[0].title" /><template v-if="hasAdminFeature">- <BBTableHeaderCell- class="w-8 table-cell"- :title="columnList[1].title"- />- <BBTableHeaderCell- class="w-72 table-cell"- :title="columnList[2].title"- />- <BBTableHeaderCell- class="w-auto table-cell"- :title="columnList[3].title"- />+ <BBTableHeaderCell class="w-8 table-cell" :title="columnList[1].title" />+ <BBTableHeaderCell class="w-72 table-cell" :title="columnList[2].title" />+ <BBTableHeaderCell class="w-auto table-cell" :title="columnList[3].title" /></template><template v-else>- <BBTableHeaderCell- class="w-72 table-cell"- :title="columnList[1].title"- />- <BBTableHeaderCell- class="w-auto table-cell"- :title="columnList[2].title"- />+ <BBTableHeaderCell class="w-72 table-cell" :title="columnList[1].title" />+ <BBTableHeaderCell class="w-auto table-cell" :title="columnList[2].title" /></template></template><template #body="{ rowData: member }">@@ -44,12 +25,8 @@<template v-if="'INVITED' == member.principal.status"><spanclass="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-main text-main-text"- >- {{ $t("settings.members.invited") }}- </span>- <span class="textlabel">- {{ member.principal.email }}- </span>+ >{{ $t("settings.members.invited") }}</span>+ <span class="textlabel">{{ member.principal.email }}</span></template><template v-else><PrincipalAvatar :principal="member.principal" />@@ -58,18 +35,13 @@<router-link:to="`/u/${member.principal.id}`"class="normal-link"- >{{ member.principal.name }}- </router-link>+ >{{ member.principal.name }}</router-link><spanv-if="currentUser.id == member.principal.id"class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-green-100 text-green-800"- >- {{ $t("common.you") }}- </span>+ >{{ $t("common.you") }}</span></div>- <span class="textlabel">- {{ member.principal.email }}- </span>+ <span class="textlabel">{{ member.principal.email }}</span></div></template></div>@@ -87,13 +59,9 @@</BBTableCell><BBTableCell class="table-cell"><div class="flex flex-row items-center space-x-1">- <span>- {{ humanizeTs(member.updatedTs) }}- </span>+ <span>{{ humanizeTs(member.updatedTs) }}</span><span>{{ $t('common.by') }}</span>- <router-link :to="`/u/${member.updater.id}`" class="normal-link"- >{{ member.updater.name }}- </router-link>+ <router-link :to="`/u/${member.updater.id}`" class="normal-link">{{ member.updater.name }}</router-link></div></BBTableCell><BBTableCell>@@ -144,7 +112,7 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const state = reactive<LocalState>({});diff --git a/frontend/src/components/ProjectSelect.vue b/frontend/src/components/ProjectSelect.vueindex 4bba4a5f0c..cc8f175f42 100644--- a/frontend/src/components/ProjectSelect.vue+++ b/frontend/src/components/ProjectSelect.vue@@ -8,44 +8,34 @@}">- <option disabled :selected="UNKNOWN_ID == state.selectedId">- Select project- </option>+ <option disabled :selected="UNKNOWN_ID == state.selectedId">Select project</option><!-- If includeDefaultProject is false but the selected project is the defaultproject, we will show it. If includeDefaultProject is true, then it's- already in the list, so no need to show it twice -->+ already in the list, so no need to show it twice--><optionv-if="!includeDefaultProject && state.selectedId == DEFAULT_PROJECT_ID":selected="true"- >- Default- </option>+ >Default</option><!-- It may happen the selected id might not be in the project list.e.g. the selected project is deleted after the selection and weare unable to cleanup properly. In such case, the seleted project id- is orphaned and we just display the id. -->+ is orphaned and we just display the id.--><optionv-else-if="selectedIdNotInList":value="state.selectedId":selected="true"- >- {{ state.selectedId }}- </option>+ >{{ state.selectedId }}</option><template v-for="(project, index) in projectList" :key="index"><optionv-if="project.rowStatus == 'NORMAL'":value="project.id":selected="project.id == state.selectedId"- >- {{ projectName(project) }}- </option>+ >{{ projectName(project) }}</option><optionv-else-if="project.id == state.selectedId":value="project.id":selected="true"- >- {{ projectName(project) }}- </option>+ >{{ projectName(project) }}</option></template></select></template>@@ -124,7 +114,7 @@ export default defineComponent({watchEffect(prepareProjectList);const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const projectList = computed((): Project[] => {diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vueindex ad853dd415..9251d13ab8 100644--- a/frontend/src/components/Quickstart.vue+++ b/frontend/src/components/Quickstart.vue@@ -1,9 +1,7 @@<template><div class="space-y-2 w-full pl-4 pr-2"><div class="flex flex-row justify-between">- <div class="outline-title toplevel flex">- {{ $t("common.quickstart") }}- </div>+ <div class="outline-title toplevel flex">{{ $t("common.quickstart") }}</div><button class="btn-icon" @click.prevent="hideQuickstart"><heroicons-solid:x class="w-4 h-4" /></button>@@ -21,9 +19,7 @@@click="intro.click"><span class="flex items-start">- <span- class="flex-shrink-0 relative h-5 w-5 flex items-center justify-center"- >+ <span class="flex-shrink-0 relative h-5 w-5 flex items-center justify-center"><template v-if="intro.done"><!-- Heroicon name: solid/check-circle --><heroicons-solid:check-circle@@ -31,24 +27,17 @@/></template><template v-else-if="isTaskActive(index)">- <span- class="absolute h-4 w-4 rounded-full bg-blue-200"- ></span>- <span- class="relative block w-2 h-2 bg-info rounded-full"- ></span>+ <span class="absolute h-4 w-4 rounded-full bg-blue-200"></span>+ <span class="relative block w-2 h-2 bg-info rounded-full"></span></template><template v-else>- <div- class="h-2 w-2 bg-gray-300 rounded-full group-hover:bg-gray-400"- ></div>+ <div class="h-2 w-2 bg-gray-300 rounded-full group-hover:bg-gray-400"></div></template></span><spanclass="ml-2 text-sm font-medium text-control-light group-hover:text-control-light-hover":class="intro.done ? 'line-through' : ''"- >{{ intro.name }}</span- >+ >{{ intro.name }}</span></span></component></li>@@ -123,7 +112,7 @@ export default defineComponent({name: computed(() => t("quick-start.visit-instance")),link: "/instance",allowDBA: true,- allowDeveloper: !store.getters["plan/feature"]("bb.dba-workflow"),+ allowDeveloper: !store.getters["plan/feature"]("bb.feature.dba-workflow"),done: computed(() => {return store.getters["uistate/introStateByKey"]("instance.visit");}),diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex ba7f1e1e15..85f802c4e2 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -94,7 +94,7 @@ const routes: Array<RouteRecordRaw> = [quickActionListByRole: () => {const ownerList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -114,7 +114,7 @@ const routes: Array<RouteRecordRaw> = [];const dbaList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -132,7 +132,7 @@ const routes: Array<RouteRecordRaw> = [];const developerList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -569,7 +569,7 @@ const routes: Array<RouteRecordRaw> = [quickActionListByRole: () => {const ownerList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -583,7 +583,7 @@ const routes: Array<RouteRecordRaw> = [];const dbaList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -597,7 +597,7 @@ const routes: Array<RouteRecordRaw> = [];const developerList: QuickActionType[] = store.getters["plan/feature"- ]("bb.dba-workflow")+ ]("bb.feature.dba-workflow")? ["quickaction.bb.database.schema.update","quickaction.bb.database.data.update",@@ -863,22 +863,7 @@ router.beforeEach((to, from, next) => {if (to.name === "workspace.instance") {if (- !store.getters["plan/feature"]("bb.dba-workflow") ||- isDBAOrOwner(currentUser.role)- ) {- next();- } else {- next({- name: "error.403",- replace: false,- });- }- return;- }-- if (to.name === "workspace.database.create") {- if (- !store.getters["plan/feature"]("bb.dba-workflow") ||+ !store.getters["plan/feature"]("bb.feature.dba-workflow") ||isDBAOrOwner(currentUser.role)) {next();@@ -893,7 +878,7 @@ router.beforeEach((to, from, next) => {if (to.name?.toString().startsWith("workspace.database.datasource")) {if (- !store.getters["plan/feature"]("bb.data-source") ||+ !store.getters["plan/feature"]("bb.feature.data-source") ||!isDBAOrOwner(currentUser.role)) {next({diff --git a/frontend/src/store/modules/plan.ts b/frontend/src/store/modules/plan.tsindex 9a41d5fb28..368d874fde 100644--- a/frontend/src/store/modules/plan.ts+++ b/frontend/src/store/modules/plan.ts@@ -2,10 +2,24 @@ import axios from "axios";import { Plan, FeatureType, PlanPatch, PlanState, PlanType } from "../../types";// A map from the a particular feature to the respective enablement of a particular plan+// Make sure this is consistent with the matrix in plan.go+//+// TODO: fetch the matrix from the backend instead of duplicating it here or use a JSON/YAML file+// so that it can be shared between frontend/backend.const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([- ["bb.admin", [false, true, true]],- ["bb.dba-workflow", [false, false, true]],- ["bb.data-source", [false, false, false]],+ // Change Workflow+ ["bb.feature.backward-compatibility", [false, true, true]],+ ["bb.feature.schema-drift", [false, true, true]],+ ["bb.feature.task-schedule-time", [false, true, true]],+ ["bb.feature.multi-tenancy", [false, true, true]],+ ["bb.feature.dba-workflow", [false, false, true]],+ ["bb.feature.data-source", [false, false, false]],+ // Policy Control+ ["bb.feature.approval-policy", [false, true, true]],+ ["bb.feature.backup-policy", [false, true, true]],+ // Admin & Security+ ["bb.feature.rbac", [false, true, true]],+ ["bb.feature.3rd-party-login", [false, true, true]],]);export const FEATURE_SECTIONS = [@@ -150,9 +164,9 @@ const getters = {feature:(state: PlanState, getters: any) =>- (type: FeatureType): boolean => {- return FEATURE_MATRIX.get(type)![getters["currentPlan"]()];- },+ (type: FeatureType): boolean => {+ return FEATURE_MATRIX.get(type)![getters["currentPlan"]()];+ },};const actions = {diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex bb1d197de3..7bf95cbc39 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -1,12 +1,18 @@+// Check api/plan.go to understand what each feature means.export type FeatureType =- // Support Owner and DBA role at the workspace level- | "bb.admin"- // Support DBA workflow, including- // 1. Developers can't create database directly, they need to do this via a request db issue.- // 2. Allow developers to submit troubleshooting ticket.- | "bb.dba-workflow"- // Support defining extra data source for a database and exposing the related data source UI.- | "bb.data-source";+ // Change Workflow+ | "bb.feature.backward-compatibility"+ | "bb.feature.schema-drift"+ | "bb.feature.task-schedule-time"+ | "bb.feature.multi-tenancy"+ | "bb.feature.dba-workflow"+ | "bb.feature.data-source"+ // Policy Control+ | "bb.feature.approval-policy"+ | "bb.feature.backup-policy"+ // Admin & Security+ | "bb.feature.rbac"+ | "bb.feature.3rd-party-login";export enum PlanType {FREE = 0,diff --git a/frontend/src/utils/role.ts b/frontend/src/utils/role.tsindex 29f6dca890..38450e9081 100644--- a/frontend/src/utils/role.ts+++ b/frontend/src/utils/role.ts@@ -9,12 +9,12 @@ export function registerStoreWithRoleUtil(theStore: Store<any>) {// Returns true if admin feature is NOT supported or the principal is OWNERexport function isOwner(role: RoleType): boolean {- return !store.getters["plan/feature"]("bb.admin") || role == "OWNER";+ return !store.getters["plan/feature"]("bb.feature.rbac") || role == "OWNER";}// Returns true if admin feature is NOT supported or the principal is DBAexport function isDBA(role: RoleType): boolean {- return !store.getters["plan/feature"]("bb.admin") || role == "DBA";+ return !store.getters["plan/feature"]("bb.feature.rbac") || role == "DBA";}export function isDBAOrOwner(role: RoleType): boolean {@@ -23,7 +23,7 @@ export function isDBAOrOwner(role: RoleType): boolean {// Returns true if admin feature is NOT supported or the principal is DEVELOPERexport function isDeveloper(role: RoleType): boolean {- return !store.getters["plan/feature"]("bb.admin") || role == "DEVELOPER";+ return !store.getters["plan/feature"]("bb.feature.rbac") || role == "DEVELOPER";}export function roleName(role: RoleType): string {@@ -39,11 +39,11 @@ export function roleName(role: RoleType): string {// Project Roleexport function isProjectOwner(role: ProjectRoleType): boolean {- return !store.getters["plan/feature"]("bb.admin") || role == "OWNER";+ return !store.getters["plan/feature"]("bb.feature.rbac") || role == "OWNER";}export function isProjectDeveloper(role: ProjectRoleType): boolean {- return !store.getters["plan/feature"]("bb.admin") || role == "DEVELOPER";+ return !store.getters["plan/feature"]("bb.feature.rbac") || role == "DEVELOPER";}export function projectRoleName(role: ProjectRoleType): string {diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vueindex 4b356daf3d..3310f1430d 100644--- a/frontend/src/views/InstanceDetail.vue+++ b/frontend/src/views/InstanceDetail.vue@@ -11,10 +11,7 @@/><div class="px-6 space-y-6"><InstanceForm :create="false" :instance="instance" />- <div- v-if="hasDataSourceFeature"- class="py-6 space-y-4 border-t divide-control-border"- >+ <div v-if="hasDataSourceFeature" class="py-6 space-y-4 border-t divide-control-border"><DataSourceTable :instance="instance" /></div><div v-else>@@ -30,27 +27,20 @@/><div class="flex items-center space-x-4"><div>- <BBSpin- v-if="state.syncingSchema"- :title="$t('instance.syncing')"- />+ <BBSpin v-if="state.syncingSchema" :title="$t('instance.syncing')" /></div><buttonv-if="allowEdit"type="button"class="btn-normal"@click.prevent="syncSchema"- >- {{ $t("instance.sync-now") }}- </button>+ >{{ $t("instance.sync-now") }}</button><buttonv-if="instance.rowStatus == 'NORMAL'"type="button"class="btn-primary"@click.prevent="createDatabase"- >- {{ $t("instance.new-database") }}- </button>+ >{{ $t("instance.new-database") }}</button></div></div><DatabaseTable@@ -117,8 +107,7 @@}"@cancel="state.showCreateMigrationSchemaModal = false"- >- </BBAlert>+ ></BBAlert><BBModalv-if="state.showCreateDatabaseModal"@@ -244,7 +233,7 @@ export default {) +(isDBAOrOwner(currentUser.value.role)? " " +- t("instance.please-check-the-instance-connection-info-is-correct")+ t("instance.please-check-the-instance-connection-info-is-correct"): " " + t("instance.please-contact-your-dba-to-configure-it")));}@@ -263,7 +252,7 @@ export default {});const hasDataSourceFeature = computed(() =>- store.getters["plan/feature"]("bb.data-source")+ store.getters["plan/feature"]("bb.feature.data-source"));const databaseList = computed(() => {diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex c4dafc1d02..0102f9d4fe 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -192,7 +192,7 @@ export default {);const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const principal = computed(() => {diff --git a/frontend/src/views/SettingWorkspaceMember.vue b/frontend/src/views/SettingWorkspaceMember.vueindex 0426e785dd..7c4b59e91e 100644--- a/frontend/src/views/SettingWorkspaceMember.vue+++ b/frontend/src/views/SettingWorkspaceMember.vue@@ -39,7 +39,7 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const hasAdminFeature = computed(() =>- store.getters["plan/feature"]("bb.admin")+ store.getters["plan/feature"]("bb.feature.rbac"));const prepareMemberList = () => {diff --git a/frontend/src/views/SqlEditor/EditorHeader.vue b/frontend/src/views/SqlEditor/EditorHeader.vueindex 6dea5de9ab..4017a37c00 100644--- a/frontend/src/views/SqlEditor/EditorHeader.vue+++ b/frontend/src/views/SqlEditor/EditorHeader.vue@@ -3,18 +3,16 @@<div class="flex items-center"><div class="flex-shrink-0 w-44"><router-link to="/" class="select-none" active-class exact-active-class>- <img- class="h-12 w-auto"- src="../../assets/logo-full.svg"- alt="Bytebase"- />+ <img class="h-12 w-auto" src="../../assets/logo-full.svg" alt="Bytebase" /></router-link></div><div class="hidden sm:block"><div class="ml-6 flex items-baseline space-x-1">- <router-link to="/sql-editor" class="bar-link px-2 py-2 rounded-md">{{- $t("sql-editor.self")- }}</router-link>+ <router-link to="/sql-editor" class="bar-link px-2 py-2 rounded-md">+ {{+ $t("sql-editor.self")+ }}+ </router-link></div></div></div>@@ -27,11 +25,7 @@></span><heroicons-outline:bell class="w-6 h-6" /></router-link>- <div- v-if="showSwitchPlan"- class="cursor-pointer"- @click="toggleLocales"- >+ <div v-if="showSwitchPlan" class="cursor-pointer" @click="toggleLocales"><heroicons-outline:translate class="w-6 h-6" /></div><div class="ml-2">@@ -62,32 +56,33 @@Open: "block", closed: "hidden"--><div v-if="state.showMobileMenu" class="block md:hidden">- <router-link to="/project" class="bar-link rounded-md block px-3 py-2">{{- $t("common.projects")- }}</router-link>-- <router-link to="/db" class="bar-link rounded-md block px-3 py-2">{{- $t("common.databases")- }}</router-link>+ <router-link to="/project" class="bar-link rounded-md block px-3 py-2">+ {{+ $t("common.projects")+ }}+ </router-link>++ <router-link to="/db" class="bar-link rounded-md block px-3 py-2">+ {{+ $t("common.databases")+ }}+ </router-link><router-linkv-if="showDBAItem"to="/instance"class="bar-link rounded-md block px-3 py-2"- >{{ $t("common.instances") }}</router-link- >+ >{{ $t("common.instances") }}</router-link><router-linkto="/environment"class="bar-link rounded-md block px-3 py-2"- >{{ $t("common.environments") }}</router-link- >+ >{{ $t("common.environments") }}</router-link><router-linkto="/setting/member"class="bar-link rounded-md block px-3 py-2"- >{{ $t("common.settings") }}</router-link- >+ >{{ $t("common.settings") }}</router-link></div></template>@@ -125,7 +120,7 @@ export default defineComponent({const showDBAItem = computed((): boolean => {return (- !store.getters["plan/feature"]("bb.dba-workflow") ||+ !store.getters["plan/feature"]("bb.feature.dba-workflow") ||isDBAOrOwner(currentUser.value.role));});diff --git a/server/acl.go b/server/acl.goindex 1840efce3f..f88effebec 100644--- a/server/acl.go+++ b/server/acl.go@@ -67,7 +67,7 @@ func aclMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Handrole := member.Role// If admin feature is not enabled, then we treat all user as OWNER.- if !s.feature("bb.admin") {+ if !s.feature("bb.feature.rbac") {role = api.Owner}// Performs the ACL check.