diff --git a/Client/src/Components/Sidebar/index.jsx b/Client/src/Components/Sidebar/index.jsx index c372f8c66..08943807a 100644 --- a/Client/src/Components/Sidebar/index.jsx +++ b/Client/src/Components/Sidebar/index.jsx @@ -90,6 +90,13 @@ function Sidebar() { const [open, setOpen] = useState({ Dashboard: false, Account: false }); const [anchorEl, setAnchorEl] = useState(null); const [popup, setPopup] = useState(); + const { user } = useSelector((state) => state.auth); + + if (!user.role.includes("superadmin")) { + menu[3].nested = menu[3].nested.filter((item) => { + return item.name !== "Password"; + }); + } const openPopup = (event, id) => { setAnchorEl(event.currentTarget); diff --git a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx index 885c795b1..69c221142 100644 --- a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx +++ b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx @@ -331,22 +331,24 @@ const ProfilePanel = () => { borderColor: theme.palette.border.light, }} /> - - - Delete account - - Note that deleting your account will remove all data from our - system. This is permanent and non-recoverable. - + {user.role.includes("superadmin") && ( + + + Delete account + + Note that deleting your account will remove all data from our + system. This is permanent and non-recoverable. + + + - - + )} {/* TODO - Update ModalPopup Component with @mui for reusability */} { const handleTabChange = (event, newTab) => { navigate(`/account/${newTab}`); }; - - let tabList = ["Profile", "Password", "Team"]; const { user } = useSelector((state) => state.auth); + + let tabList = ["Profile", "Team"]; + if (user.role.includes("superadmin")) { + tabList.push("Password"); + } const requiredRoles = ["superadmin", "admin"]; const hideTeams = !requiredRoles.some((role) => user.role.includes(role)); if (hideTeams) { @@ -74,7 +77,7 @@ const Account = ({ open = "profile" }) => { - + {user.role.includes("superadmin") && } {!hideTeams && }