From 18485da3da4fc5fdf9ad7b54b293cc6592bf252f Mon Sep 17 00:00:00 2001 From: Lucas Magnus Date: Tue, 27 Feb 2024 09:34:44 -0300 Subject: [PATCH] feat: remove superadmin change your role --- .../src/components/templates/profile/index.tsx | 14 ++++++++------ .../templates/role-permissions-template/index.tsx | 6 +++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/templates/profile/index.tsx b/frontend/src/components/templates/profile/index.tsx index cd0b514..e5b0a1c 100644 --- a/frontend/src/components/templates/profile/index.tsx +++ b/frontend/src/components/templates/profile/index.tsx @@ -102,12 +102,14 @@ export const ProfileTemplate: React.FC = ({ alignItems="center" > {profile?.role} - } - aria-label={'Edit'} - onClick={onOpen} - /> + {!userPermissions?.admin && ( + } + aria-label={'Edit'} + onClick={onOpen} + /> + )} = ({ updatingRolesPermissions, changes, profile, + userPermissions, onSubmit, setChanges, }) => { @@ -80,7 +81,10 @@ export const RolePermissionsTemplate: React.FC = ({ } const isDisabled = (role: Hooks.UseAuthTypes.IRole): boolean => { - return role.admin === 1 || role.created_by != profile?.id + if (userPermissions?.admin) { + return false + } + return role.created_by != profile?.id } return (