Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Tbauthmenu: Access Checks For Your Menus

$
0
0
Hi all,

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!
- Dan

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>