diff --git a/addons/api/mirage/factories/auth-method.js b/addons/api/mirage/factories/auth-method.js index dee5481a3..46ac67090 100644 --- a/addons/api/mirage/factories/auth-method.js +++ b/addons/api/mirage/factories/auth-method.js @@ -10,6 +10,7 @@ import generateId from '../helpers/id'; import { TYPE_AUTH_METHOD_OIDC, + TYPE_AUTH_METHOD_LDAP, TYPES_AUTH_METHOD, } from 'api/models/auth-method'; @@ -46,7 +47,7 @@ export default factory.extend({ user.update({ accountIds: [id] }); }); - if (type === TYPE_AUTH_METHOD_OIDC) { + if (type === TYPE_AUTH_METHOD_OIDC || type === TYPE_AUTH_METHOD_LDAP) { server .createList('managed-group', 2, { scope, authMethod }) .map((managedGroup) => { diff --git a/addons/api/mirage/factories/managed-group.js b/addons/api/mirage/factories/managed-group.js index 40db17b40..90ccfd852 100644 --- a/addons/api/mirage/factories/managed-group.js +++ b/addons/api/mirage/factories/managed-group.js @@ -10,7 +10,6 @@ import generateId from '../helpers/id'; import { TYPE_AUTH_METHOD_OIDC, TYPE_AUTH_METHOD_LDAP, - TYPES_AUTH_METHOD, } from 'api/models/auth-method'; export default factory.extend({ @@ -24,7 +23,9 @@ export default factory.extend({ id: () => generateId('mg_'), - type: (i) => TYPES_AUTH_METHOD[i % TYPES_AUTH_METHOD.length], + type() { + return this.authMethod?.type; + }, attributes() { switch (this.type) { diff --git a/addons/api/mirage/scenarios/default.js b/addons/api/mirage/scenarios/default.js index 8efe720d4..6cc62d550 100644 --- a/addons/api/mirage/scenarios/default.js +++ b/addons/api/mirage/scenarios/default.js @@ -3,6 +3,8 @@ * SPDX-License-Identifier: MPL-2.0 */ +import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method'; + export default function (server) { // Scope resources @@ -66,11 +68,13 @@ export default function (server) { globalScopeRoles.forEach((role) => { const { scope } = role; const oidcAuthMethod = globalAuthMethods.filter( - (auth) => auth.type === 'oidc' + (auth) => auth.type === TYPE_AUTH_METHOD_OIDC )[0]; + const { type } = oidcAuthMethod; const managedGroups = server.createList('managed-group', 2, { scope, authMethodId: oidcAuthMethod.id, + type, }); role.update({ managedGroups }); }); @@ -85,11 +89,13 @@ export default function (server) { orgScopeRoles.forEach((role) => { const { scope } = role; const oidcAuthMethod = orgAuthMethods.filter( - (auth) => auth.type === 'oidc' + (auth) => auth.type === TYPE_AUTH_METHOD_OIDC )[0]; + const { type } = oidcAuthMethod; const managedGroups = server.createList('managed-group', 2, { scope, authMethodId: oidcAuthMethod.id, + type, }); role.update({ managedGroups }); });