About filter for backend and frontend

This commit is contained in:
bscheshirwork
2018-09-14 18:16:55 +03:00
parent 26837b7fd9
commit bcdf9985f2

View File

@ -66,6 +66,52 @@ $module = Yii::$app->getModule('user');
if(Yii::$app->session->has($module->switchIdentitySessionKey))
```
## BackendFilter and FrontendFilter
BackendFilter disable this controllers: 'profile', 'recovery', 'registration', 'settings';
FrontendFilter disable this controller: 'admin';
This functional is dropped.
Use `deny` rule in your configuration directly.
For example change `frontend` config like this:
```
'modules' => [
'user' => [
'controllerMap' => [
'admin' => [
'class' => Da\User\Controller\AdminController::class,
'as access' => [
'class' => yii\filters\AccessControl::class,
'rules' => [['allow' => false]],
],
],
'role' => [
'class' => Da\User\Controller\RoleController::class,
'as access' => [
'class' => yii\filters\AccessControl::class,
'rules' => [['allow' => false]],
],
],
'permission' => [
'class' => Da\User\Controller\PermissionController::class,
'as access' => [
'class' => yii\filters\AccessControl::class,
'rules' => [['allow' => false]],
],
],
'rule' => [
'class' => Da\User\Controller\RuleController::class,
'as access' => [
'class' => yii\filters\AccessControl::class,
'rules' => [['allow' => false]],
],
],
],
],
],
```
## Rbac migrations
[yii2-rbac](https://github.com/dektrium/yii2-rbac) have a nice tool which are rbac migrations, which help writing new permissions and roles.