From 0a7517fd7bd734fb8cf3cc55ec4b549be2776672 Mon Sep 17 00:00:00 2001 From: Youssef Date: Thu, 21 Oct 2021 23:20:48 +0100 Subject: [PATCH] disable drag and drop for envs based on permissions --- .../EnvironmentListItem.tsx | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx index cfcfa6742f..bd177ebdef 100644 --- a/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx +++ b/frontend/src/component/environments/EnvironmentList/EnvironmentListItem/EnvironmentListItem.tsx @@ -110,11 +110,15 @@ const EnvironmentListItem = ({ }); const opacity = isDragging ? 0 : 1; - drag(drop(ref)); const { hasAccess } = useContext(AccessContext); + const updatePermission = hasAccess(UPDATE_ENVIRONMENT); const tooltipText = env.enabled ? 'Disable' : 'Enable'; + if (updatePermission) { + drag(drop(ref)); + } + return ( } /> - - - - - - + + + + + } + /> +