2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2021-11-04 16:26:09 -07:00
|
|
|
import factory from '../generated/factories/managed-group';
|
2022-08-01 11:25:07 -07:00
|
|
|
import { faker } from '@faker-js/faker';
|
2021-10-29 13:23:41 -07:00
|
|
|
import permissions from '../helpers/permissions';
|
2022-06-01 14:02:18 -04:00
|
|
|
import generateId from '../helpers/id';
|
2021-10-29 13:23:41 -07:00
|
|
|
|
2021-11-10 16:12:42 -05:00
|
|
|
const types = ['oidc'];
|
|
|
|
|
|
2021-10-29 13:23:41 -07:00
|
|
|
export default factory.extend({
|
2021-11-10 16:12:42 -05:00
|
|
|
type: (i) => types[i % types.length],
|
2021-10-29 13:23:41 -07:00
|
|
|
|
|
|
|
|
authorized_actions: () =>
|
2021-11-04 16:26:09 -07:00
|
|
|
permissions.authorizedActionsFor('managed-group') || [
|
2021-10-29 13:23:41 -07:00
|
|
|
'no-op',
|
|
|
|
|
'read',
|
|
|
|
|
'update',
|
|
|
|
|
'delete',
|
|
|
|
|
],
|
2021-11-10 09:07:17 -08:00
|
|
|
|
2022-06-01 14:02:18 -04:00
|
|
|
id: () => generateId('mg_'),
|
|
|
|
|
|
2021-11-10 09:07:17 -08:00
|
|
|
attributes() {
|
|
|
|
|
switch (this.type) {
|
|
|
|
|
case 'oidc':
|
|
|
|
|
return {
|
2022-08-01 11:25:07 -07:00
|
|
|
filter: faker.random.words(),
|
2021-11-10 09:07:17 -08:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-10-29 13:23:41 -07:00
|
|
|
});
|