add role checking to controllers

This commit is contained in:
2015-11-05 17:24:09 +01:00
parent 43d5598f23
commit cc83ccf761
39 changed files with 362 additions and 78 deletions

View File

@@ -14,6 +14,32 @@ use yii\filters\VerbFilter;
*/
class AccountController extends \backend\controllers\BackendController
{
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => [ 'index','view' ],
'allow' => true,
'roles' => ['employee','admin','reception'],
],
// allow authenticated users
[
'actions' => [ 'create', 'update'],
'allow' => true,
'roles' => ['admin'],
],
// everything else is denied
],
],
];
}
/**
* Lists all Account models.