Disable the two-factor authentication for enterprise users
What does this MR do and why?
Group owners are now able to disable the two-factor authentication for enterprise user in the members page.
Closes Add new dropdown and modal to disable 2FA for e... (#385619 - closed)
Screenshots or screen recordings
Screenshots
Dropdown menu:
Confirmation modal:
Recording
Screen_Recording_2023-01-06_at_21.09.20
How to set up and validate locally
- Enable the
group_owners_to_disable_two_factor
from the Rails consolegdk rails console
:
Feature.enable(:group_owners_to_disable_two_factor)
- Go to the Flightjs group members page: https://gdk.test:3443/groups/flightjs/-/group_members
- Apply this patch below to simulate an enterprise user with two-factor authentication enable.
- Disable the two-factor authentication for the first user.
Click to expand
diff --git a/app/assets/javascripts/members/index.js b/app/assets/javascripts/members/index.js
index 359239c5c0c..00a28ea267f 100644
--- a/app/assets/javascripts/members/index.js
+++ b/app/assets/javascripts/members/index.js
@@ -22,7 +22,447 @@ export const initMembersApp = (el, options) => {
canFilterByEnterprise,
exportCsvPath,
...vuexStoreAttributes
- } = parseDataAttributes(el);
+ } = {
+ user: {
+ members: [
+ {
+ id: 462,
+ createdAt: '2022-12-22T19:27:30.635Z',
+ expiresAt: null,
+ requestedAt: null,
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ user: {
+ id: 395,
+ username: 'user00',
+ name: 'Abdul Okta',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/1a1a74d497a3f4bb94e3f7a7491028f8?s=80&d=identicon',
+ webUrl: 'https://gdk.test:3443/user00',
+ showStatus: false,
+ availability: null,
+ createdAt: '2022-12-22T19:27:30.506Z',
+ lastActivityOn: '2023-01-06',
+ blocked: false,
+ isBot: false,
+ twoFactorEnabled: true,
+ oncallSchedules: [],
+ escalationPolicies: [],
+ },
+ state: 0,
+ usingLicense: false,
+ groupSso: true,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: true,
+ canUnban: true,
+ canGetTwoFactorDisabled: true,
+ banned: false,
+ },
+ {
+ id: 461,
+ createdAt: '2022-12-22T19:23:45.072Z',
+ expiresAt: null,
+ requestedAt: null,
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ user: {
+ id: 394,
+ username: 'adelegitlab',
+ name: 'Adele GitLab',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/bab670410a77b942aff4afaae25ef8a4?s=80&d=identicon',
+ webUrl: 'https://gdk.test:3443/adelegitlab',
+ showStatus: false,
+ availability: null,
+ createdAt: '2022-12-22T19:02:45.278Z',
+ lastActivityOn: '2022-12-22',
+ blocked: false,
+ isBot: false,
+ twoFactorEnabled: false,
+ oncallSchedules: [],
+ escalationPolicies: [],
+ },
+ state: 0,
+ usingLicense: false,
+ groupSso: true,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: false,
+ canUnban: true,
+ canGetTwoFactorDisabled: false,
+ banned: false,
+ },
+ {
+ id: 460,
+ createdAt: '2022-12-22T18:56:28.185Z',
+ expiresAt: null,
+ requestedAt: null,
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ user: {
+ id: 393,
+ username: 'user02',
+ name: 'Amelia Okta',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/84b5a4476ad119a54ce8248893859697?s=80&d=identicon',
+ webUrl: 'https://gdk.test:3443/user02',
+ showStatus: false,
+ availability: null,
+ createdAt: '2022-12-22T18:56:27.898Z',
+ lastActivityOn: '2022-12-22',
+ blocked: false,
+ isBot: false,
+ twoFactorEnabled: false,
+ oncallSchedules: [],
+ escalationPolicies: [],
+ },
+ state: 0,
+ usingLicense: false,
+ groupSso: true,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: true,
+ canUnban: true,
+ canGetTwoFactorDisabled: false,
+ banned: false,
+ },
+ ],
+ pagination: {
+ currentPage: 1,
+ perPage: 50,
+ totalItems: 7,
+ paramName: 'page',
+ params: {
+ invited_members_page: null,
+ search_invited: null,
+ },
+ },
+ memberPath: '/groups/flightjs/-/group_members/:id',
+ disableTwoFactorPath: '/groups/flightjs/-/two_factor_auth',
+ ldapOverridePath: '/groups/flightjs/-/group_members/:id/override',
+ },
+ group: {
+ members: [
+ {
+ id: 1,
+ createdAt: '2022-12-09T16:43:36.404Z',
+ expiresAt: null,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ },
+ sharedWithGroup: {
+ avatarUrl: null,
+ webUrl: 'https://gdk.test:3443/groups/2fa_enforced',
+ id: 184,
+ name: '2fa_enforced',
+ fullPath: '2fa_enforced',
+ fullName: '2fa_enforced',
+ },
+ canUpdate: true,
+ canRemove: true,
+ isDirectMember: true,
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ },
+ ],
+ pagination: {
+ currentPage: null,
+ perPage: null,
+ totalItems: 1,
+ paramName: null,
+ params: {},
+ },
+ memberPath: '/groups/flightjs/-/group_links/:id',
+ },
+ invite: {
+ members: [
+ {
+ id: 428,
+ createdAt: '2022-12-21T09:45:30.481Z',
+ expiresAt: null,
+ requestedAt: null,
+ createdBy: {
+ name: 'Super Administrator',
+ webUrl: 'https://gdk.test:3443/root',
+ },
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ state: 0,
+ invite: {
+ email: 'rubocom@a.com',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/848c9b3f4de106b3ce6be82279ef9d50?s=80&d=identicon',
+ canResend: true,
+ userState: null,
+ },
+ usingLicense: null,
+ groupSso: false,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: false,
+ canUnban: true,
+ canGetTwoFactorDisabled: false,
+ banned: false,
+ },
+ ],
+ pagination: {
+ currentPage: 1,
+ perPage: 50,
+ totalItems: 1,
+ paramName: 'invited_members_page',
+ params: {
+ page: null,
+ },
+ },
+ memberPath: '/groups/flightjs/-/group_members/:id',
+ disableTwoFactorPath: '/groups/flightjs/-/two_factor_auth',
+ ldapOverridePath: '/groups/flightjs/-/group_members/:id/override',
+ },
+ accessRequest: {
+ members: [
+ {
+ id: 426,
+ createdAt: '2022-12-21T09:39:47.359Z',
+ expiresAt: null,
+ requestedAt: '2022-12-21T09:39:47.344Z',
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Developer',
+ integerValue: 30,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ user: {
+ id: 21,
+ username: 'charles',
+ name: 'Young Murphy',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/14e9bcc5b5bb1065bbc505338d4ce54d?s=80&d=identicon',
+ webUrl: 'https://gdk.test:3443/charles',
+ showStatus: false,
+ availability: null,
+ createdAt: '2022-05-12T15:49:02.547Z',
+ lastActivityOn: '2022-12-21',
+ blocked: false,
+ isBot: false,
+ twoFactorEnabled: true,
+ oncallSchedules: [],
+ escalationPolicies: [],
+ },
+ state: 0,
+ usingLicense: false,
+ groupSso: false,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: false,
+ canUnban: true,
+ canGetTwoFactorDisabled: false,
+ banned: false,
+ },
+ ],
+ pagination: {
+ currentPage: null,
+ perPage: null,
+ totalItems: 1,
+ paramName: null,
+ params: {},
+ },
+ memberPath: '/groups/flightjs/-/group_members/:id',
+ disableTwoFactorPath: '/groups/flightjs/-/two_factor_auth',
+ ldapOverridePath: '/groups/flightjs/-/group_members/:id/override',
+ },
+ sourceId: 31,
+ canManageMembers: true,
+ canManageAccessRequests: true,
+ canExportMembers: true,
+ exportCsvPath: '/groups/flightjs/-/group_members/export_csv',
+ canFilterByEnterprise: true,
+ banned: {
+ members: [
+ {
+ id: 427,
+ createdAt: '2022-12-21T09:41:46.229Z',
+ expiresAt: null,
+ requestedAt: null,
+ createdBy: {
+ name: 'Super Administrator',
+ webUrl: 'https://gdk.test:3443/root',
+ },
+ canUpdate: true,
+ canRemove: true,
+ isLastOwner: false,
+ isDirectMember: true,
+ accessLevel: {
+ stringValue: 'Guest',
+ integerValue: 10,
+ },
+ source: {
+ id: 31,
+ fullName: 'Flightjs',
+ webUrl: 'https://gdk.test:3443/groups/flightjs',
+ },
+ type: 'GroupMember',
+ validRoles: {
+ Guest: 10,
+ Reporter: 20,
+ Developer: 30,
+ Maintainer: 40,
+ Owner: 50,
+ 'Minimal Access': 5,
+ },
+ user: {
+ id: 29,
+ username: 'reported_user_7',
+ name: 'Brianna Lehner',
+ avatarUrl:
+ 'https://secure.gravatar.com/avatar/70bdca730b2045df686f396eb4231d06?s=80&d=identicon',
+ webUrl: 'https://gdk.test:3443/reported_user_7',
+ showStatus: false,
+ availability: null,
+ createdAt: '2022-05-12T15:51:03.084Z',
+ lastActivityOn: '2023-01-06',
+ blocked: false,
+ isBot: false,
+ twoFactorEnabled: false,
+ oncallSchedules: [],
+ escalationPolicies: [],
+ },
+ state: 0,
+ usingLicense: false,
+ groupSso: false,
+ groupManagedAccount: false,
+ canOverride: false,
+ isOverridden: false,
+ provisionedByThisGroup: false,
+ canUnban: true,
+ canGetTwoFactorDisabled: false,
+ banned: true,
+ },
+ ],
+ pagination: {
+ currentPage: null,
+ perPage: null,
+ totalItems: 1,
+ paramName: null,
+ params: {},
+ },
+ memberPath: '/groups/flightjs/-/group_members/:id',
+ disableTwoFactorPath: '/groups/flightjs/-/two_factor_auth',
+ ldapOverridePath: '/groups/flightjs/-/group_members/:id/override',
+ },
+ };
const modules = Object.keys(MEMBER_TYPES).reduce((accumulator, namespace) => {
const namespacedOptions = options[namespace];
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Eduardo Sanz García