O'Reilly logo

Yii Rapid Application Development Hotshot by James R. Hamilton III, Lauren J. O'Meara

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

User Specific Menus

In the last task, we limited user access, but we did not update the menus. The site menu provides links to objects that users do not have permission to access, and the object menus provide links to actions that users do not have authorization to take. It would be nice if we could associate the menus to the access we have already defined, so that we do not have to manually coordinate menu contents with accessRules. To do this, we created an extension to the CMenu widget.

Engage Thrusters

  1. Create a new file in ch3 | Source Files | protected | components named AuthMenu.php.
  2. Enter the following contents into the file:
    <?php Yii::import('zii.widgets.CMenu'); /** * Auth Menu extends CMenu to apply access rules to menu items before * displaying ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required