In order to ensure proper access control for the application I was developing, I structured my routing system to cascade down based on user permissions. While this approach made sense from a logical standpoint, I encountered difficulties in implementing it within Express.js.
Specifically, I faced challenges preventing "Project Managers" from accessing the Admin route. Instead, they should only be allowed to navigate through the ManagerRouter and DeveloperRouter paths.
https://i.sstatic.net/wFBw3.png
I'm struggling to escape the undesired route. Although the code appears to execute the 'else' statement correctly, it fails to prevent access:
https://i.sstatic.net/rRomX.png
Is there a solution within Express that can address this issue?