<commit_before># Simpler RBAC using custom access control filter

Yii2-user comes with access control rule which adds support of `admin` role which allows access to users
added to `admins` property of the module.

## Apply filter to your controller

Here is an example of how to use access rule in your access control filter:

```php
<?php

namespace app\controllers;

use yii\filters\AccessControl;
use app\filters\AccessRule;
use yii\web\Controller;

class SiteController extends Controller
{
	...
	public function behaviors()
	{
		return [
			'access' => [
			    'class' => AccessControl::className(),
			    'ruleConfig' => [
			        'class' => AccessRule::className(),
			    ],
			    'rules' => [
			        [
			            'actions' => ['create'],
			            'allow' => true,
			            'roles' => ['admin'],
			        ],
			        [
			            'actions' => ['view', 'search'],
			            'allow' => true,
			            'roles' => ['?', '@', 'admin'],
			        ],
			    ],
			],
		];
	}
	...
}
```
<commit_msg>Fixed docs<commit_after># Simpler RBAC using custom access control filter

Yii2-user comes with access control rule which adds support of `admin` role which allows access to users
added to `admins` property of the module.

## Apply filter to your controller

Here is an example of how to use access rule in your access control filter:

```php
<?php

namespace app\controllers;

use yii\filters\AccessControl;
use dektrium\user\filters\AccessRule;
use yii\web\Controller;

class SiteController extends Controller
{
	...
	public function behaviors()
	{
		return [
			'access' => [
			    'class' => AccessControl::className(),
			    'ruleConfig' => [
			        'class' => AccessRule::className(),
			    ],
			    'rules' => [
			        [
			            'actions' => ['create'],
			            'allow' => true,
			            'roles' => ['admin'],
			        ],
			        [
			            'actions' => ['view', 'search'],
			            'allow' => true,
			            'roles' => ['?', '@', 'admin'],
			        ],
			    ],
			],
		];
	}
	...
}
```

{'fraction_non_alphanumeric': 0.14258464473056748, 'fraction_numerical': 0.0009537434430138292, 'mean_word_length': 2.0717423133235724, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6933426', 'n_tokens_mistral': 705, 'n_tokens_neox': 587, 'n_words': 181}