1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: permissions in the role payload (#4861)

Fixes the role payload to include only the needed properties from
permissions. Fixes `400` (oneOf schema validation error) in project role
creation.
This commit is contained in:
Nuno Góis 2023-09-28 15:55:46 +01:00 committed by GitHub
parent 72cca4f450
commit 3cf8761364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -44,7 +44,9 @@ export const useRoleForm = (
name, name,
description, description,
type: type === ROOT_ROLE_TYPE ? 'root-custom' : 'custom', type: type === ROOT_ROLE_TYPE ? 'root-custom' : 'custom',
permissions: Object.values(checkedPermissions), permissions: Object.values(checkedPermissions).map(
({ name, environment }) => ({ name, environment })
),
}); });
const isNameUnique = (name: string) => { const isNameUnique = (name: string) => {

View File

@ -4,7 +4,7 @@ import useAPI from '../useApi/useApi';
interface IRolePayload { interface IRolePayload {
name: string; name: string;
description: string; description: string;
permissions: IPermission[]; permissions: Pick<IPermission, 'name' | 'environment'>[];
} }
export const useRolesApi = () => { export const useRolesApi = () => {