Simple RBAC

Comparing #5 with #6

Revision #6 was created by François Gannaz François Gannaz on Apr 30, 2012, 3:54:13 PM.

Fixed 2 links

Content

[...]
),
```

*Sidenote:*
[CWebUser::checkAccess()] usually connects to the authorization system loaded in Yii.
Here we are replacing it with a simple system that just deals with roles instead of the hierarchical system defined by the derivatives of [CAuthManager]. See the official tutorial, [
Role-Based Access Control](http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#role-based-access-control](Role-Based Access Control) for details.

## Checking permissions: usage
[...]
Here the "admin" action of the controller has restricted access: only those with roles "staff" or "devel" can access it.

As described in the API doc of [
CAccessRule](http://www.yiiframework.com/doc/api/1.1/CAccessRule#roles-detail](CAccessRule), the "roles" attribute will in fact call `Yii::app()->user->checkAccess()`.

### How to display a different menu according to roles

You can also use just one menu for all users based upon different roles. for example
[...]