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: added feature gate for sync project member from VCS (#780)
Zilong Zhoub11b89a49f65
diff --git a/api/plan.go b/api/plan.goindex ec6ae2dcb4..224e2e7e46 100644--- a/api/plan.go+++ b/api/plan.go@@ -90,10 +90,10 @@ const (// - Project level RBACFeatureRBAC FeatureType = "bb.feature.rbac"- // Feature3rdPartyLogin allows user to login using 3rd party account.+ // Feature3rdPartyAuth allows user to authenticate (login) and authorize (sync project member)//- // Currently, we only support GitLab EE/CE OAuth login.- Feature3rdPartyLogin FeatureType = "bb.feature.3rd-party-login"+ // Currently, we only support GitLab EE/CE auth.+ Feature3rdPartyAuth FeatureType = "bb.feature.3rd-party-auth")func (e FeatureType) String() string {@@ -116,8 +116,8 @@ func (e FeatureType) String() string {return "bb.feature.backup-policy"case FeatureRBAC:return "bb.feature.rbac"- case Feature3rdPartyLogin:- return "bb.feature.3rd-party-login"+ case Feature3rdPartyAuth:+ return "bb.feature.3rd-party-auth"}return ""}@@ -143,8 +143,8 @@ func (e FeatureType) Name() string {return "Backup policy"case FeatureRBAC:return "RBAC"- case Feature3rdPartyLogin:- return "3rd party login"+ case Feature3rdPartyAuth:+ return "3rd party auth"}return ""}@@ -177,7 +177,7 @@ var FeatureMatrix = map[FeatureType][3]bool{"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},+ "bb.feature.3rd-party-auth": {false, true, true},}// Plan is the API message for a plan.diff --git a/frontend/src/components/ProjectMemberPanel.vue b/frontend/src/components/ProjectMemberPanel.vueindex d11a0c8431..1ae0501755 100644--- a/frontend/src/components/ProjectMemberPanel.vue+++ b/frontend/src/components/ProjectMemberPanel.vue@@ -15,23 +15,14 @@<heroicons-outline:refreshv-if="project.roleProvider !== 'BYTEBASE'"class="ml-1 inline text-sm normal-link"- @click.prevent="- () => {- syncMemberFromVCS();- }- "+ @click.prevent="onRefreshSync"/><div class="w-auto ml-3 inline-block align-middle"><BBSwitch:value="project.roleProvider !== 'BYTEBASE'"@toggle="(on) => {- // we prompt a modal to let user double confirm this change- state.showModal = true;- if (!on) {- // we preview member if user try to switch role provider to Bytebase- state.previewMember = true;- }+ onToggleRoleProvider(on);}"/>@@ -173,6 +164,11 @@</div><ProjectMemberTable :project="project" /></div>+ <FeatureModal+ v-if="state.showFeatureModal"+ :feature="'bb.feature.3rd-party-auth'"+ @cancel="state.showFeatureModal = false"+ /></template><script lang="ts">@@ -201,6 +197,7 @@ interface LocalState {showModal: boolean;roleProvider: boolean;previewMember: boolean;+ showFeatureModal: boolean;}export default defineComponent({@@ -225,6 +222,11 @@ export default defineComponent({showModal: false,roleProvider: false,previewMember: false,+ showFeatureModal: false,+ });++ const has3rdPartyAuthFeature = computed(() => {+ return store.getters["subscription/feature"]("bb.feature.3rd-party-auth");});const hasRBACFeature = computed(() =>@@ -360,6 +362,27 @@ export default defineComponent({});};+ const onRefreshSync = () => {+ if (!has3rdPartyAuthFeature.value) {+ state.showFeatureModal = true;+ return;+ }+ syncMemberFromVCS();+ };++ const onToggleRoleProvider = (on: boolean) => {+ if (!has3rdPartyAuthFeature.value && on) {+ state.showFeatureModal = true;+ return;+ }+ // we prompt a modal to let user double confirm this change+ state.showModal = true;+ if (!on) {+ // we preview member if user try to switch role provider to Bytebase+ state.previewMember = true;+ }+ };+return {state,hasRBACFeature,@@ -372,6 +395,9 @@ export default defineComponent({syncMemberFromVCS,openWindowForVCSMember,patchProjectRoleProvider,+ has3rdPartyAuthFeature,+ onRefreshSync,+ onToggleRoleProvider,};},});diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.ymlindex 16b80b7b8b..2aedf70a2e 100644--- a/frontend/src/locales/en.yml+++ b/frontend/src/locales/en.yml@@ -1259,15 +1259,15 @@ subscription:desc: >-Role management can assign a particular role (e.g. DBA) to a member.@:{'subscription.upgrade'} to unlock this feature.- bb-feature-3rd-party-login:- title: 3rd-party login- desc: >-- Bytebase auto-support 3rd-party login based on your VCS configuration.- @:{'subscription.upgrade'} to unlock this feature.- login: "@:{'subscription.upgrade'} to unlock this feature"bb-feature-schema-drift:title: Schema driftdesc: "@:{'subscription.upgrade'} to unlock schema dirft auto-detection"+ bb-feature-3rd-party-auth:+ title: 3rd party authentication & authorization+ desc: >-+ Bytebase supports 3rd-party authentication & authorization based on your VCS configuration.+ @:{'subscription.upgrade'} to unlock this feature.+ login: "@:{'subscription.upgrade'} to unlock this feature"feature-sections:database-management:title: Database Development@@ -1307,7 +1307,7 @@ subscription:features:activity-log: Activity logrbac: RBAC (Owner, DBA, Developer role)- gitlab-login: Login with GitLab account+ 3rd-party-auth: 3rd party authentication & authorizationplan:title: Plantry: Try Teamdiff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.ymlindex eaaf033a08..dc0e450186 100644--- a/frontend/src/locales/zh-CN.yml+++ b/frontend/src/locales/zh-CN.yml@@ -1099,13 +1099,14 @@ subscription:bb-feature-rbac:title: 角色管理desc: 「角色管理」可以赋予成员诸如 DBA 这样的特定角色,可以通过@:{'subscription.upgrade'}来开启该功能。- bb-feature-3rd-party-login:- title: 第三方登录- desc: Bytebase 可自动根据您配置的 VCS 来支持相应的第三方登录。请通过@:{'subscription.upgrade'}来开启该功能。- login: 请@:{'subscription.upgrade'}来开启该功能bb-feature-schema-drift:title: Schema 偏差desc: "@:{'subscription.upgrade'}来解锁 schema 偏差异常的自动检测。"+ bb-feature-3rd-party-auth:+ title: 第三方认证 & 授权+ desc: >-+ Bytebase 可根据您配置的 VCS 来支持相应的第三方认证 & 授权。请通过@:{'subscription.upgrade'}来开启该功能。+ login: 请@:{'subscription.upgrade'}来开启该功能feature-sections:database-management:title: 数据库管理@@ -1145,7 +1146,7 @@ subscription:features:activity-log: 活动日志rbac: RBAC 权限管理- gitlab-login: 通过 GitLab 账户登录+ 3rd-party-auth: 第三方认证 & 授权plan:title: 版本try: 试用团队版diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex e862d8aa4b..274b02ec70 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -12,7 +12,7 @@ export type FeatureType =| "bb.feature.backup-policy"// Admin & Security| "bb.feature.rbac"- | "bb.feature.3rd-party-login";+ | "bb.feature.3rd-party-auth";export enum PlanType {FREE = 0,@@ -55,7 +55,7 @@ export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([["bb.feature.backup-policy", [false, true, true]],// Admin & Security["bb.feature.rbac", [false, true, true]],- ["bb.feature.3rd-party-login", [false, true, true]],+ ["bb.feature.3rd-party-auth", [false, true, true]],]);export const FEATURE_SECTIONS = [@@ -87,7 +87,7 @@ export const FEATURE_SECTIONS = [},{id: "admin-and-security",- features: ["activity-log", "rbac", "gitlab-login"],+ features: ["activity-log", "rbac", "3rd-party-auth"],},];@@ -179,7 +179,7 @@ export const TEAM_PLAN: Plan = {{ id: "inbox-notification" },{ id: "activity-log" },{ id: "rbac" },- { id: "gitlab-login" },+ { id: "3rd-party-auth" },],};@@ -228,6 +228,6 @@ export const ENTERPRISE_PLAN: Plan = {{ id: "inbox-notification" },{ id: "activity-log" },{ id: "rbac" },- { id: "gitlab-login" },+ { id: "3rd-party-auth" },],};diff --git a/frontend/src/views/SettingWorkspaceVCS.vue b/frontend/src/views/SettingWorkspaceVCS.vueindex b837ee0682..a522a421f3 100644--- a/frontend/src/views/SettingWorkspaceVCS.vue+++ b/frontend/src/views/SettingWorkspaceVCS.vue@@ -19,9 +19,9 @@<FeatureAttentionv-if="!has3rdPartyLoginFeature && vcsList.length > 0"custom-class="mb-5"- feature="bb.feature.3rd-party-login"+ feature="bb.feature.3rd-party-auth":description="- $t('subscription.features.bb-feature-3rd-party-login.desc')+ $t('subscription.features.bb-feature-3rd-party-auth.desc')"/><div v-if="vcsList.length > 0" class="space-y-6">@@ -74,9 +74,7 @@ export default {};const has3rdPartyLoginFeature = computed((): boolean => {- return store.getters["subscription/feature"](- "bb.feature.3rd-party-login"- );+ return store.getters["subscription/feature"]("bb.feature.3rd-party-auth");});return {diff --git a/frontend/src/views/auth/Signin.vue b/frontend/src/views/auth/Signin.vueindex 7d39ceaf82..738cb4a7b7 100644--- a/frontend/src/views/auth/Signin.vue+++ b/frontend/src/views/auth/Signin.vue@@ -38,7 +38,7 @@$t("auth.sign-in.gitlab-demo")}}</span><span v-else-if="!has3rdPartyLoginFeature" class="tooltip">{{- $t("subscription.features.bb-feature-3rd-party-login.login")+ $t("subscription.features.bb-feature-3rd-party-auth.login")}}</span></n-button></template>@@ -292,9 +292,7 @@ export default {};const has3rdPartyLoginFeature = computed((): boolean => {- return store.getters["subscription/feature"](- "bb.feature.3rd-party-login"- );+ return store.getters["subscription/feature"]("bb.feature.3rd-party-auth");});return {