manual merge from main

This commit is contained in:
Randall Morey committed 2021-01-29 16:13:36 -05:00
commit 09c125bb0a
26 files changed
+533 -338

No files matched your search

+10 -3
View File
@@ -325,14 +325,21 @@ export default function() {
this.get('/sessions', function ({ sessions }, { queryParams: { scope_id } }) {
// To simulate changes to `session.status` that may occur in the backend,
// we quietly randomize the value of the field on GET.
// To populate sessions for logged in user,
// update alternate sessions to auth user.
// But only if not in testing mode.
// In tests, we need deterministic statuses.
if (!Ember.testing) {
sessions.where(session => session.scopeId === scope_id)
.models
.forEach(session => session.update({
status: pickRandomStatusString()
}));
.forEach(session => {
session.update({
status: pickRandomStatusString()
});
if(session.id.split('-').pop() % 2) session.update({
userId: 'authenticateduser'
});
});
}
return sessions.where(session => session.scopeId === scope_id)
});
+2 -3
View File
@@ -1,4 +1,4 @@
import factory from '../generated/factories/target';
import factory from '../generated/factories/session';
import { trait } from 'ember-cli-mirage';
import { random } from 'faker';
@@ -26,8 +26,7 @@ export default factory.extend({
const scopeId = record.scopeId;
if (record.scope.type === 'project') {
const orgScopeId = record.scope?.scope.id;
const user =
server.schema.users.where({ scopeId: orgScopeId }).models[0];
const user = server.schema.users.where({ scopeId: orgScopeId }).models[0];
if (user) record.update({ user });
}
const target = server.schema.targets.where({ scopeId }).models[0];
+1 -1
View File
@@ -38,7 +38,7 @@ export function authHandler({ scopes, authMethods }, request) {
id: 'token123',
token: 'thetokenstring',
account_id: '1',
user_id: 'user123',
user_id: 'authenticateduser',
auth_method_id: 'authmethod123',
created_time: '',
updated_time: '',
+2 -1
View File
@@ -13,6 +13,8 @@ export default function(server) {
scope: { id: globalScope.id, type: globalScope.type }
}, 'withChildren')[0];
server.create('user', { id: 'authenticateduser' });
// Auth
server.createList('auth-method', 1, { scope: globalScope }, 'withAccountsAndUsers');
server.createList('auth-method', 3, { scope: orgScope }, 'withAccountsAndUsers');
@@ -30,5 +32,4 @@ export default function(server) {
server.createList('target', 2, { scope }, 'withRandomHostSets');
server.createList('session', 4, { scope }, 'withAssociations');
});
}