feat: write endpoints to update SamlAuthProvidersRoleMappings
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { createRole } from './role.js';
|
||||
import SamlAuthProvidersRoleMapping from '../../src/models/saml-auth-providers-role-mapping.ee.js';
|
||||
import { createSamlAuthProvider } from './saml-auth-provider.ee.js';
|
||||
|
||||
export const createSamlAuthProvidersRoleMapping = async (params = {}) => {
|
||||
params.roleId = params.roleId || (await createRole()).id;
|
||||
params.samlAuthProviderId =
|
||||
params.samlAuthProviderId || (await createSamlAuthProvider()).id;
|
||||
params.remoteRoleName = params.remoteRoleName || faker.person.jobType();
|
||||
|
||||
const samlAuthProvider =
|
||||
await SamlAuthProvidersRoleMapping.query().insertAndFetch(params);
|
||||
|
||||
return samlAuthProvider;
|
||||
};
|
@@ -0,0 +1,23 @@
|
||||
const createRoleMappingsMock = async (roleMappings) => {
|
||||
const data = roleMappings.map((roleMapping) => {
|
||||
return {
|
||||
id: roleMapping.id,
|
||||
samlAuthProviderId: roleMapping.samlAuthProviderId,
|
||||
roleId: roleMapping.roleId,
|
||||
remoteRoleName: roleMapping.remoteRoleName,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
data: data,
|
||||
meta: {
|
||||
count: data.length,
|
||||
currentPage: null,
|
||||
isArray: true,
|
||||
totalPages: null,
|
||||
type: 'SamlAuthProvidersRoleMapping',
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default createRoleMappingsMock;
|
Reference in New Issue
Block a user