From 23ab3c1a8a26284e87503b389c597b58866ee27b Mon Sep 17 00:00:00 2001
From: Kyle Johnson
Date: Tue, 12 Nov 2024 14:38:10 +0000
Subject: [PATCH] fix: Handle environment admin not being able to check
VIEW_PROJECT permissions (#4827)
---
frontend/web/components/EditPermissions.tsx | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/frontend/web/components/EditPermissions.tsx b/frontend/web/components/EditPermissions.tsx
index 957e83f7e065..d5278568248b 100644
--- a/frontend/web/components/EditPermissions.tsx
+++ b/frontend/web/components/EditPermissions.tsx
@@ -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')
@@ -255,6 +256,7 @@ const _EditPermissionsModal: FC = withAdminPermissions(
createRolePermissionGroup,
{ data: groupsData, isSuccess: groupAdded },
] = useCreateRolePermissionGroupMutation()
+ const [parentWarning, setParentWarning] = useState(false)
const [deleteRolePermissionGroup] = useDeleteRolePermissionGroupMutation()
@@ -394,6 +396,10 @@ const _EditPermissionsModal: FC = withAdminPermissions(
setParentError(false)
}
})
+ .catch(() => {
+ setParentWarning(true)
+ return []
+ })
}
if (!role) {
parentGet
@@ -758,6 +764,13 @@ const _EditPermissionsModal: FC = withAdminPermissions(
.
+ {!!parentWarning && (
+
+ 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.
+
+ )}
{parentError && !role && (