| @@ 18-40 (lines=23) @@ | ||
| 15 | /** |
|
| 16 | * {@inheritdoc} |
|
| 17 | */ |
|
| 18 | public function behaviors() |
|
| 19 | { |
|
| 20 | return [ |
|
| 21 | 'access' => [ |
|
| 22 | 'class' => AccessControl::className(), |
|
| 23 | 'rules' => [ |
|
| 24 | [ |
|
| 25 | 'allow' => true, |
|
| 26 | 'actions' => ['error'], |
|
| 27 | ], |
|
| 28 | [ |
|
| 29 | 'allow' => true, |
|
| 30 | 'matchCallback' => function ($rule, $action) { |
|
| 31 | return \Yii::$app->user->can( |
|
| 32 | $this->module->id.'_'.$this->id.'_'.$action->id, |
|
| 33 | ['route' => true] |
|
| 34 | ); |
|
| 35 | }, |
|
| 36 | ], |
|
| 37 | ], |
|
| 38 | ], |
|
| 39 | ]; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * {@inheritdoc} |
|
| @@ 21-43 (lines=23) @@ | ||
| 18 | /** |
|
| 19 | * {@inheritdoc} |
|
| 20 | */ |
|
| 21 | public function behaviors() |
|
| 22 | { |
|
| 23 | return [ |
|
| 24 | 'access' => [ |
|
| 25 | 'class' => AccessControl::className(), |
|
| 26 | 'rules' => [ |
|
| 27 | [ |
|
| 28 | 'allow' => true, |
|
| 29 | 'actions' => ['error'], |
|
| 30 | ], |
|
| 31 | [ |
|
| 32 | 'allow' => true, |
|
| 33 | 'matchCallback' => function ($rule, $action) { |
|
| 34 | return \Yii::$app->user->can( |
|
| 35 | $this->module->id.'_'.$this->id.'_'.$action->id, |
|
| 36 | ['route' => true] |
|
| 37 | ); |
|
| 38 | }, |
|
| 39 | ], |
|
| 40 | ], |
|
| 41 | ], |
|
| 42 | ]; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Actions defined in classes, eg. error page. |
|