Role permissions tab should display object permissions from API result (#10344)

## Context
Role all-objects permissions were mocked. Now that the backend returns
it, we are using its values.

<img width="556" alt="Screenshot 2025-02-19 at 18 39 07"
src="https://github.com/user-attachments/assets/9a1c57fd-dc18-43ef-bc2d-be738d1716f5"
/>
This commit is contained in:
Weiko
2025-02-19 18:58:19 +01:00
committed by GitHub
parent 4a2a312efd
commit 65bd1d7775
3 changed files with 24 additions and 8 deletions

View File

@ -22,7 +22,15 @@ const StyledRolePermissionsContainer = styled.div`
`;
type RolePermissionsProps = {
role: Pick<Role, 'id' | 'canUpdateAllSettings'>;
role: Pick<
Role,
| 'id'
| 'canUpdateAllSettings'
| 'canReadAllObjectRecords'
| 'canUpdateAllObjectRecords'
| 'canSoftDeleteAllObjectRecords'
| 'canDestroyAllObjectRecords'
>;
};
export const RolePermissions = ({ role }: RolePermissionsProps) => {
@ -31,25 +39,25 @@ export const RolePermissions = ({ role }: RolePermissionsProps) => {
key: 'seeRecords',
label: 'See Records on All Objects',
icon: <IconEye size={14} />,
value: true,
value: role.canReadAllObjectRecords,
},
{
key: 'editRecords',
label: 'Edit Records on All Objects',
icon: <IconPencil size={14} />,
value: true,
value: role.canUpdateAllObjectRecords,
},
{
key: 'deleteRecords',
label: 'Delete Records on All Objects',
icon: <IconTrash size={14} />,
value: true,
value: role.canSoftDeleteAllObjectRecords,
},
{
key: 'destroyRecords',
label: 'Destroy Records on All Objects',
icon: <IconTrashX size={14} />,
value: true,
value: role.canDestroyAllObjectRecords,
},
];