I’m just beginning to develop with Yii, and before I get too deep into the RBAC/database user table stuff, I just want to dynamically display and flex certain menu items based on the default (e.g. demo, admin) usernames for the starter application.
So basically, I found I need to set the ‘visible’ property of each menu item (e.g. in main.php and other files where menus are used) to see whether it should be visible depending on the username. To be able to set this appropriately (probably in the login authenticate method) for all menus in the application it would seem to mean that I need something “global” like Yii::app() but I don’t think I want to subclass that and add a property???
Is there some other (or existing) way to have every menu throughout the application have access to the username (or proxy, e.g. isAdmin, isDemo) of the current user in order to set the visible property for the menu item?
Thanks.