This commit is contained in:
sianida26 2024-05-15 20:08:45 +07:00
parent fb411c8fd3
commit 70767a1b24

View File

@ -76,19 +76,14 @@ const dashboardRoutes = router.get("/getSidebarItems", async (c) => {
} }
//if menu has no children, check if permission match //if menu has no children, check if permission match
else { else if (
if ( menu.allowedPermissions?.some((perm) =>
menu.allowedPermissions?.some((perm) => permissions.includes(perm)
permissions.includes(perm) ) ||
) || menu.allowedPermissions?.includes("*")
menu.allowedPermissions?.includes("*") ) {
) { //add menu and hide the allowed permissions field
//add menu and hide the allowed permissions field return [...prev, { ...menu, allowedPermissions: undefined }];
return [
...prev,
{ ...menu, allowedPermissions: undefined },
];
}
} }
//dont add permission to menu if it doesnt match //dont add permission to menu if it doesnt match