title: How to create Access (view page) role in yii?
body: <p>How to create access role in yii and where in yii application part ?</p>
  
  <p>I want to create access role in yii application but I have a problem and don't know about where to assign role in yii like I have three department role: </p>
  
  <p>1.admin -: admin have a all access role in our application</p>
  
  <p>2.staff -: staff same of page and access role like to edit or update </p>
  
  <p>3.user -: user have a all access page only viewing in our application</p>
  
  <p>These type of role can set in controller but I can justify where to write all access in yii and how to set access role ,</p>
  
  <p>I try this type code in controller and here I have role in session I
  cheeked by using this: </p>
  
  <p><strong>admin but this con't access these type page  and show error message (anotharization action )</strong></p>
  
  <pre><code> echo Yii::app()-&gt;user-&gt;getState('roles'); 
      public function accessRules()
     {
        return array(  
             array('allow', //allow admin user to perform 'index'&amp;'view' actions
                  'actions'=&gt;array('index','view'),
                  'users'=&gt;array('admin'),
                  'roles'=&gt;array('admin'),
                  ),
        );
     }
  </code></pre>