I whipped up a quick extension to the TbMenu/CMenu class that allows showing/hiding menu items using RBAC. There are a few extensions that do something similar, but they didn't offer the control I needed and/or overrode my settings with odd defaults.
Parameters / Features:
- authCheckAll - Whether to check every menu item, even if its authItem is not specified
- authCheckNestedItems - Whether to check sub-items. (Ie $item['items])
- authItem - Name of the auth item to check
- authParams - Array of parameters to pass to checkAccess
- authUser - ID of the user to check access for. Defaults to current user.
- authResult - The expected return value of checkAccess. If something else is returned, the item and its children won't be displayed
Parameters are checked at both the menu and item levels, with item-level parameters taking precedence.
Hope it helps!
Number of downloads: 41