feat: 🎸 add grant schema to mirage (#3196)
* feat: 🎸 add grant schema to mirage * refactor: 💡 update grant schema mirage data * refactor: 💡 fix route name in mirage
This commit is contained in:
1 parent
37de7e3480
commit
759c1f5555
2 files changed
+258
No files matched your search
@@ -11,6 +11,7 @@ import initializeMockDesktopContextBridgeAPI from './scenarios/ipc/desktop-conte
|
||||
import makeBooleanFilter from './helpers/bexpr-filter';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { asciicasts } from './data/asciicasts';
|
||||
import { grantsSchemaData } from './data/grants-schema';
|
||||
import { TYPE_WORKER_PKI } from 'api/models/worker';
|
||||
import environmentConfig from 'ember-get-config';
|
||||
|
||||
@@ -210,6 +211,10 @@ function routes() {
|
||||
return metadata;
|
||||
});
|
||||
|
||||
this.get('/grants-schema.json', () => {
|
||||
return grantsSchemaData;
|
||||
});
|
||||
|
||||
// make this `/api`, for example, if your API is namespaced
|
||||
this.namespace = environmentConfig.api?.namespace;
|
||||
// delay for each request, automatically set to 0 during testing
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
/**
|
||||
* Copyright IBM Corp. 2021, 2026
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
export const grantsSchemaData = {
|
||||
resource_types: [
|
||||
{
|
||||
type: 'auth-method',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['change-state', 'authenticate', 'read', 'update', 'delete'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['ampw', 'amoidc', 'amldap'],
|
||||
},
|
||||
{
|
||||
type: 'account',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: [
|
||||
'set-password',
|
||||
'change-password',
|
||||
'read',
|
||||
'update',
|
||||
'delete',
|
||||
],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['acctoidc', 'acctldap', 'apw', 'acctpw'],
|
||||
parent_type: 'auth-method',
|
||||
},
|
||||
{
|
||||
type: 'host',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['hst', 'hplg', 'h'],
|
||||
parent_type: 'host-catalog',
|
||||
},
|
||||
{
|
||||
type: 'session',
|
||||
collection_actions: ['list'],
|
||||
id_actions: ['read', 'read:self', 'cancel', 'cancel:self'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['s'],
|
||||
},
|
||||
{
|
||||
type: 'credential-store',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['csst', 'cs', 'csvlt'],
|
||||
},
|
||||
{
|
||||
type: 'alias',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['global'],
|
||||
id_prefixes: ['alt'],
|
||||
},
|
||||
{
|
||||
type: 'user',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: [
|
||||
'list-resolvable-aliases',
|
||||
'read',
|
||||
'update',
|
||||
'delete',
|
||||
'add-accounts',
|
||||
'set-accounts',
|
||||
'remove-accounts',
|
||||
],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['u'],
|
||||
},
|
||||
{
|
||||
type: 'auth-token',
|
||||
collection_actions: ['list'],
|
||||
id_actions: ['read', 'read:self', 'delete', 'delete:self'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['at'],
|
||||
},
|
||||
{
|
||||
type: 'target',
|
||||
collection_actions: ['list', 'create'],
|
||||
id_actions: [
|
||||
'add-credential-sources',
|
||||
'remove-credential-sources',
|
||||
'delete',
|
||||
'set-host-sources',
|
||||
'set-credential-sources',
|
||||
'authorize-session',
|
||||
'read',
|
||||
'update',
|
||||
'add-host-sources',
|
||||
'remove-host-sources',
|
||||
],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['trdp', 'ttcp', 'tssh'],
|
||||
},
|
||||
{
|
||||
type: 'worker',
|
||||
collection_actions: [
|
||||
'create:controller-led',
|
||||
'create:worker-led',
|
||||
'list',
|
||||
'read-certificate-authority',
|
||||
'reinitialize-certificate-authority',
|
||||
],
|
||||
id_actions: [
|
||||
'set-worker-tags',
|
||||
'remove-worker-tags',
|
||||
'read',
|
||||
'update',
|
||||
'delete',
|
||||
'add-worker-tags',
|
||||
],
|
||||
scopes: ['global'],
|
||||
id_prefixes: ['w'],
|
||||
},
|
||||
{
|
||||
type: 'managed-group',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['update', 'delete', 'read'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['mgoidc', 'mgldap'],
|
||||
parent_type: 'auth-method',
|
||||
},
|
||||
{
|
||||
type: 'credential-library',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['clvllt', 'clvsclt', 'clvlt'],
|
||||
parent_type: 'credential-store',
|
||||
},
|
||||
{
|
||||
type: 'credential',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: [
|
||||
'credupd',
|
||||
'credp',
|
||||
'credspk',
|
||||
'cdvlt',
|
||||
'credjson',
|
||||
'cred',
|
||||
'credup',
|
||||
],
|
||||
parent_type: 'credential-store',
|
||||
},
|
||||
{
|
||||
type: 'group',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: [
|
||||
'update',
|
||||
'delete',
|
||||
'add-members',
|
||||
'set-members',
|
||||
'remove-members',
|
||||
'read',
|
||||
],
|
||||
scopes: ['global', 'org', 'project'],
|
||||
id_prefixes: ['g'],
|
||||
},
|
||||
{
|
||||
type: 'role',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: [
|
||||
'add-grant-scopes',
|
||||
'update',
|
||||
'add-principals',
|
||||
'add-grants',
|
||||
'set-grant-scopes',
|
||||
'remove-grant-scopes',
|
||||
'read',
|
||||
'delete',
|
||||
'set-principals',
|
||||
'remove-principals',
|
||||
'set-grants',
|
||||
'remove-grants',
|
||||
],
|
||||
scopes: ['global', 'org', 'project'],
|
||||
id_prefixes: ['r'],
|
||||
},
|
||||
{
|
||||
type: 'host-catalog',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['hcst', 'hc', 'hcplg'],
|
||||
},
|
||||
{
|
||||
type: 'host-set',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: [
|
||||
'delete',
|
||||
'add-hosts',
|
||||
'set-hosts',
|
||||
'remove-hosts',
|
||||
'read',
|
||||
'update',
|
||||
],
|
||||
scopes: ['project'],
|
||||
id_prefixes: ['hsst', 'hsplg', 'hs'],
|
||||
parent_type: 'host-catalog',
|
||||
},
|
||||
{
|
||||
type: 'storage-bucket',
|
||||
collection_actions: ['list', 'create'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['sb'],
|
||||
},
|
||||
{
|
||||
type: 'policy',
|
||||
collection_actions: ['create', 'list'],
|
||||
id_actions: ['read', 'update', 'delete'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['pst'],
|
||||
},
|
||||
{
|
||||
type: 'billing',
|
||||
collection_actions: ['monthly-active-users'],
|
||||
scopes: ['global'],
|
||||
},
|
||||
{
|
||||
type: 'scope',
|
||||
collection_actions: [
|
||||
'destroy-key-version',
|
||||
'create',
|
||||
'list',
|
||||
'list-keys',
|
||||
'rotate-keys',
|
||||
'list-key-version-destruction-jobs',
|
||||
],
|
||||
id_actions: [
|
||||
'attach-storage-policy',
|
||||
'detach-storage-policy',
|
||||
'read',
|
||||
'update',
|
||||
'delete',
|
||||
],
|
||||
scopes: ['global', 'org', 'project'],
|
||||
id_prefixes: ['o', 'global', 'p'],
|
||||
},
|
||||
{
|
||||
type: 'session-recording',
|
||||
collection_actions: ['list'],
|
||||
id_actions: ['read', 'download', 'delete', 'reapply-storage-policy'],
|
||||
scopes: ['global', 'org'],
|
||||
id_prefixes: ['sr'],
|
||||
},
|
||||
],
|
||||
};
|
||||
Reference in new issue
Block a user