Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: allow workspace owner to disable user's mfa config (#9107)
zll60044dd66bc939d
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex bdb0346a3b..1f28fc3d71 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -189,7 +189,7 @@url="https://www.bytebase.com/docs/administration/2fa?source=console"/></p>- <template v-if="isMFAEnabled">+ <template v-if="showRegenerateRecoveryCodes"><div class="w-full flex flex-row justify-between items-center mt-8"><span class="text-lg font-medium">{{$t("two-factor.recovery-codes.self")@@ -325,7 +325,12 @@ const hasRBACFeature = featureToRef("bb.feature.rbac");const has2FAFeature = featureToRef("bb.feature.2fa");const isMFAEnabled = computed(() => {- return authStore.currentUser.mfaEnabled;+ return user.value.mfaEnabled;+});++// only user can regenerate their recovery-codes.+const showRegenerateRecoveryCodes = computed(() => {+ return user.value.mfaEnabled && user.value.name === currentUserV1.value.name;});const user = computed(() => {@@ -335,9 +340,16 @@ const user = computed(() => {return currentUserV1.value;});+// User can change her MFA config.+// Besides, owner can also change anyone's MFA config.const showMFAConfig = computed(() => {- // Only show MFA config for the user themselves.- return user.value.name === currentUserV1.value.name;+ return (+ user.value.name === currentUserV1.value.name ||+ hasWorkspacePermissionV1(+ "bb.permission.workspace.manage-member",+ currentUserV1.value.userRole+ )+ );});const passwordMismatch = computed(() => {@@ -433,7 +445,13 @@ const enable2FA = () => {};const disable2FA = () => {- if (actuatorStore.serverInfo?.require2fa) {+ if (+ actuatorStore.serverInfo?.require2fa &&+ !hasWorkspacePermissionV1(+ "bb.permission.workspace.manage-member",+ currentUserV1.value.userRole+ )+ ) {pushNotification({module: "bytebase",style: "WARN",@@ -445,17 +463,16 @@ const disable2FA = () => {};const handleDisable2FA = async () => {- const user = authStore.currentUser;await userStore.updateUser(UpdateUserRequest.fromPartial({user: {- name: user.name,+ name: user.value.name,mfaEnabled: false,},updateMask: ["mfa_enabled"],}));- await authStore.refreshUserIfNeeded(user.name);+ await userStore.fetchUser(user.value.name, true /* slient */);state.showDisable2FAConfirmModal = false;pushNotification({module: "bytebase",