feat: List accounts within a managed group
This commit is contained in:
11 files changed
+207
-6
No files matched your search
@@ -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');
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user