add backend theme AdminLte, bind reception/transaction to a permission
This commit is contained in:
@@ -30,9 +30,9 @@ class UserController extends \backend\controllers\BackendController
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => [ 'index','view' ],
|
||||
'actions' => [ 'index','view' ,'role'],
|
||||
'allow' => true,
|
||||
'roles' => ['employee','admin','reception'],
|
||||
'roles' => ['employee','admin' ],
|
||||
],
|
||||
// allow authenticated users
|
||||
[
|
||||
@@ -176,6 +176,44 @@ class UserController extends \backend\controllers\BackendController
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new User model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionRole()
|
||||
{
|
||||
$model = new \backend\models\RoleForm();
|
||||
|
||||
$model->availablePermissions = [
|
||||
[
|
||||
'name' => "reception.transfers",
|
||||
'description' => 'Tranzakciók'
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) ) {
|
||||
if ( $model->validate() && $model->save()){
|
||||
Yii::$app->session->setFlash('success', 'Jogosultságok elmentve');
|
||||
return $this->redirect(['role' ]);
|
||||
}
|
||||
}else{
|
||||
$am = Yii::$app->authManager;
|
||||
$children = $am->getChildren(User::ROLE_RECEPTION);
|
||||
$model->permissions = [];
|
||||
foreach ($children as $child){
|
||||
$model->permissions[] = $child->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('role', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the User model based on its primary key value.
|
||||
|
||||
Reference in New Issue
Block a user