Now, let's move to viewing and managing categories. As outlined previously, each category will be accessible via a dedicated route and will only display content within that category. We'll start by defining our default access rules and layout name in protected/controllers/CategoryController.php
:
public $layout = 'default'; public function filters() { return array( 'accessControl', ); } public function accessRules() { return array( array('allow', 'actions' => array('index', 'view', 'rss'), 'users' => array('*') ), array('allow', 'actions' => array('admin', 'save', 'delete'), 'users'=>array('@'), 'expression' => 'Yii::app()->user->role==2' ), array('deny', // deny all users 'users'=>array('*'), ), ); }