Skip to content

Commit

Permalink
fix: Handle environment admin not being able to check VIEW_PROJECT pe…
Browse files Browse the repository at this point in the history
…rmissions (#4827)
  • Loading branch information
kyle-ssg authored Nov 12, 2024
1 parent 247857f commit 23ab3c1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frontend/web/components/EditPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import classNames from 'classnames'
import OrganisationProvider from 'common/providers/OrganisationProvider'
import { useHasPermission } from 'common/providers/Permission'
import PlanBasedAccess from './PlanBasedAccess'
import WarningMessage from './WarningMessage'

const Project = require('common/project')

Expand Down Expand Up @@ -255,6 +256,7 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(
createRolePermissionGroup,
{ data: groupsData, isSuccess: groupAdded },
] = useCreateRolePermissionGroupMutation()
const [parentWarning, setParentWarning] = useState(false)

const [deleteRolePermissionGroup] = useDeleteRolePermissionGroupMutation()

Expand Down Expand Up @@ -394,6 +396,10 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(
setParentError(false)
}
})
.catch(() => {
setParentWarning(true)
return []
})
}
if (!role) {
parentGet
Expand Down Expand Up @@ -758,6 +764,13 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(
.
</p>

{!!parentWarning && (
<InfoMessage>
You do not have permission to verify whether this user has view
access for this {parentLevel}. If you need assistance, please
contact a {parentLevel} administrator.
</InfoMessage>
)}
{parentError && !role && (
<div className='mt-4'>
<InfoMessage>
Expand Down

0 comments on commit 23ab3c1

Please sign in to comment.