Revision #116 has been created by rackycz on Sep 27, 2019, 8:18:40 AM with the memo:
edit
« previous (#115) next (#117) »
Changes
Title
unchanged
Yii v2 snippet guide
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
**Simple access rights**
---
Every controller can allow different users/guests to use different actions. Method behaviors() can be used to do this. If you generate the controller using GII the method will be present and you will just add the "access-part" like this:
```php
// don't forget to add this import:
use yii\filters\AccessControl;
public function behaviors() {
return [
// ...
'access' => [
'class' => AccessControl::className(),
'rules' => [[...]