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:
parent
72cca4f450
commit
3cf8761364
@ -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) => {
|
||||||
|
@ -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 = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user