Difference between #10 and #18 of
Installing Yii Users and Rights to Newly Created Yii app

Changes

Title unchanged

Installing Yii Users and Rights to Newly Created Yii app

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

yii user, right, user, Authentication, access control, rights, Role based access control

Content changed

[...]
Create tables for user module
-----------------------------

then goto /protected/modules/user/data/schema.mysql.sql
** 
 
Need to update schema.mysql.sql to create field `lastvisit_at` instead of `lastvisit`

open the sql file ,and create the tables manually(that i prefer) , remove the 'tbl_' prefix from the tables(i prefer)
[...]
),
```

 
Change 
 
 
 
 
 
 
 
```php 
'authManager'=>array(
 
            'class'=>'RDbAuthManager',
 
            'connectionID'=>'db',
 
            'itemTable'=>'authitem',
 
        'itemChildTable'=>'authitemchild',
 
        'assignmentTable'=>'authassignment',
 
        'rightsTable'=>'rights',
 
        ),
 
```


Your application is now ready .
[...]
```php
$this->widget('zii.widgets.CMenu',array(
            'items'=>array(                 array('label'=>Yii::t('app','Home'), 'url'=>array('/site/index')), array('label'=>Yii::t('app','About'), 'url'=>array('/site/page', 'view'=>'about')), array('label'=>Yii::t('app','Contact'), 'url'=>array('/site/contact')),                 array('label'=>Yii::t('app','Login'), 'url'=>array('/user/login'),
 
               
'visible'=>Yii::app()->user->isGuest),
 
 array('label'=>Yii::t('app','Rights'), 'url'=>array('/rights')),  'visible'=>Yii::app()->user->isGuest),
 
array('label'=>
               array('label'=>Yii::t('app','Logout').' ('.Yii::app()->user->name.')', 'url'=>array('/user/logout'), 'visible'=>!Yii::app()->user->isGuest) ),
 
));
 
```
 
 
 
 
 
 
 
 
            ,
 
        )));
 
```
 
 
 
 
 
Add rights 
 
----------
 
 
Then add rights filter to all controller
 
 
like
 
 
 
 
 
```php 
public function filters()
 
{
 
return array(
 
'rights', // perform access control for CRUD operations
 

 
);
 
}
 
```
 
 
and change the extended controller to 'extends RController'.
 
 
then take rights in your url(according to url style) . 
 
 
 
continue
 
------------------
 
 
[http://www.yiiframework.com/wiki/448/assigning-dynamic-roles-to-a-user-using-yii-rights-module-at-the-time-of-user-creation-and-using-some-special-features-of-yii-rights/](http://www.yiiframework.com/wiki/448/assigning-dynamic-roles-to-a-user-using-yii-rights-module-at-the-time-of-user-creation-and-using-some-special-features-of-yii-rights/ "continue")
11 1
40 followers
Viewed: 107 892 times
Version: 1.1
Category: Tutorials
Written by: Rajith R
Last updated by: Rajith R
Created on: Nov 27, 2012
Last updated: 10 years ago
Update Article

Revisions

View all history