feat: List accounts within a managed group

This commit is contained in:
Susmitha Girumala committed 2021-11-12 11:22:16 -05:00
1 parent ff5cc71f60
commit be5f033712
11 files changed
+207 -6

No files matched your search

+11 -2
View File
@@ -77,8 +77,17 @@ export default function () {
// Auth Method Accounts
this.get(
'/accounts',
({ accounts }, { queryParams: { auth_method_id: authMethodId } }) => {
return accounts.where({ authMethodId });
(
{ accounts },
{ queryParams: { auth_method_id: authMethodId, filter } }
) => {
let resultSet;
if (authMethodId) {
resultSet = accounts.where({ authMethodId });
} else {
resultSet = accounts.all();
}
return resultSet.filter(makeBooleanFilter(filter));
}
);
this.post('/accounts');
+11 -1
View File
@@ -36,7 +36,17 @@ export default factory.extend({
});
if (type === 'oidc') {
server.createList('managed-group', 2, { scope, authMethod });
server
.createList('managed-group', 2, { scope, authMethod })
.map((managedGroup) => {
const accounts = server.createList('account', 2, {
scope,
type,
authMethod,
});
const accountIds = accounts.map((account) => account.id);
managedGroup.update({ memberIds: accountIds });
});
}
},
}),