I'm in the middle of implementing permissions on a multi-level tabbed/dropdown menu navigation setup. Is there a better method to implementing permissions compared to wrapping each menu item in an if statement?
User permissions are stored in a table and pulled in to an array, there are 10 menu items and each menu item has numerous sub-menu items. I have, for example, 20 different columns in the database that are boolean flags to indicate access to a particular menu item.
Home
Admin -----> Users
Notices
Setup
Projects --> Active Projects
Inactive Projects
Updates
Reports
Preferences
Research --> Open Tickets
Closed Tickets
Unassigned
Ideally, I want to have a flag for each menu item that determines if the individual account has access to that section. The only method to pull this off I can come up with is wrapping each menu item in an if condition, but this right off the bat sounds like it will get rather unmanageable quickly.
I'm not concerned about performance, since the generated menu is cached on creation (and the cached version referenced each time unless the user permissions are detected to have changed from the cached version - then a new menu is generated).