Refactor type to use const values (#1695)
* refactor: 💡 use auth-method type consts
This commit is contained in:
1 parent
8d77bc60b3
commit
fde4ec4e05
13 files changed
+55
-27
No files matched your search
@@ -10,6 +10,7 @@ import { hash, all } from 'rsvp';
|
||||
import { loading } from 'ember-loading';
|
||||
import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
import { resourceFilter } from 'core/decorators/resource-filter';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
// =services
|
||||
@@ -75,12 +76,12 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
|
||||
const oidcAuthMethods = scopeIDs?.length
|
||||
? await this.resourceFilterStore.queryBy(
|
||||
'auth-method',
|
||||
{ scope_id: scopeIDs, type: 'oidc' },
|
||||
{ scope_id: scopeIDs, type: TYPE_AUTH_METHOD_OIDC },
|
||||
{ scope_id: 'global', recursive: true }
|
||||
)
|
||||
: await this.resourceFilterStore.queryBy(
|
||||
'auth-method',
|
||||
{ type: 'oidc' },
|
||||
{ type: TYPE_AUTH_METHOD_OIDC },
|
||||
{ scope_id: 'global', recursive: true }
|
||||
);
|
||||
//extract oidc authMethod IDs
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
// //currentSession,
|
||||
// //invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | auth methods | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -73,7 +74,7 @@ module('Acceptance | auth methods | update', function (hooks) {
|
||||
assert.expect(12);
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
await visit(`${urls.authMethods}/${instances.authMethod.id}`);
|
||||
await click('form [type="button"]:not(:disabled)', 'Activate edit mode');
|
||||
|
||||
@@ -25,6 +25,10 @@ import {
|
||||
invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import Service from '@ember/service';
|
||||
import {
|
||||
TYPE_AUTH_METHOD_PASSWORD,
|
||||
TYPE_AUTH_METHOD_OIDC,
|
||||
} from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | authentication', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -76,15 +80,15 @@ module('Acceptance | authentication', function (hooks) {
|
||||
scope = { id: orgScope.id, type: orgScope.type };
|
||||
globalAuthMethod = this.server.create('auth-method', {
|
||||
scope: globalScope,
|
||||
type: 'password',
|
||||
type: TYPE_AUTH_METHOD_PASSWORD,
|
||||
});
|
||||
authMethod = this.server.create('auth-method', {
|
||||
scope: orgScope,
|
||||
type: 'password',
|
||||
type: TYPE_AUTH_METHOD_PASSWORD,
|
||||
});
|
||||
authMethodOIDC = this.server.create('auth-method', {
|
||||
scope: orgScope,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
orgScopeID = orgScope.id;
|
||||
globalAuthMethodID = globalAuthMethod.id;
|
||||
|
||||
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { Response } from 'miragejs';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | managed-groups | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -40,7 +41,7 @@ module('Acceptance | managed-groups | create', function (hooks) {
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
instances.managedGroup = this.server.create('managed-group', {
|
||||
scope: instances.scopes.org,
|
||||
|
||||
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { Response } from 'miragejs';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | managed-groups | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -40,7 +41,7 @@ module('Acceptance | managed-groups | delete', function (hooks) {
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
instances.managedGroup = this.server.create('managed-group', {
|
||||
scope: instances.scopes.org,
|
||||
|
||||
@@ -8,6 +8,7 @@ import { visit, click, find } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | managed-groups | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -38,7 +39,7 @@ module('Acceptance | managed-groups | list', function (hooks) {
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
instances.managedGroup = this.server.create('managed-group', {
|
||||
scope: instances.scopes.org,
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
//currentSession,
|
||||
//invalidateSession,
|
||||
} from 'ember-simple-auth/test-support';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | managed-groups | members', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -47,7 +48,7 @@ module('Acceptance | managed-groups | members', function (hooks) {
|
||||
'auth-method',
|
||||
{
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
},
|
||||
'withAccountsAndUsersAndManagedGroups'
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import { setupApplicationTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
|
||||
|
||||
module('Acceptance | managed-groups | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
@@ -39,7 +40,7 @@ module('Acceptance | managed-groups | read', function (hooks) {
|
||||
});
|
||||
instances.authMethod = this.server.create('auth-method', {
|
||||
scope: instances.scopes.org,
|
||||
type: 'oidc',
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
instances.managedGroup = this.server.create('managed-group', {
|
||||
scope: instances.scopes.org,
|
||||
|
||||
Reference in new issue
Block a user