Skip to content

Commit

Permalink
feat: remove superadmin change your role
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmagnus committed Feb 27, 2024
1 parent 092e5d0 commit 18485da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions frontend/src/components/templates/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,14 @@ export const ProfileTemplate: React.FC<IProfileTemplate> = ({
alignItems="center"
>
<Text fontWeight="400">{profile?.role}</Text>
<IconButton
variant="icon"
icon={<EditIcon />}
aria-label={'Edit'}
onClick={onOpen}
/>
{!userPermissions?.admin && (
<IconButton
variant="icon"
icon={<EditIcon />}
aria-label={'Edit'}
onClick={onOpen}
/>
)}
</Flex>
</Flex>
<Flex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const RolePermissionsTemplate: React.FC<IRolePermissionsTemplate> = ({
updatingRolesPermissions,
changes,
profile,
userPermissions,
onSubmit,
setChanges,
}) => {
Expand Down Expand Up @@ -80,7 +81,10 @@ export const RolePermissionsTemplate: React.FC<IRolePermissionsTemplate> = ({
}

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 (
Expand Down

0 comments on commit 18485da

Please sign in to comment.