Browse Source

Simplifier la page utilisateurs dans le backend

Suppression des boutons d'action (create, update, delete) car le boulanger n'a pas à avoir de pouvoir d'action sur les données utilisateur + adaptation des droits dans le controller.

Suppression du bouton pointant vers la liste des emails car cette dernière ne fonctionne pas. A voir.
master
keun 8 years ago
parent
commit
a9493725ef
2 changed files with 10 additions and 21 deletions
  1. +8
    -2
      backend/controllers/UserController.php
  2. +2
    -19
      backend/views/user/index.php

+ 8
- 2
backend/controllers/UserController.php View File

'allow' => true, 'allow' => true,
'roles' => ['@'], 'roles' => ['@'],
'matchCallback' => function ($rule, $action) { 'matchCallback' => function ($rule, $action) {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER;
if($action->actionMethod == 'actionIndex')
{
return Yii::$app->user->identity->status == USER::STATUS_ADMIN
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER ;
}
else {
return Yii::$app->user->identity->status == USER::STATUS_ADMIN ;
}
} }
] ]
], ],

+ 2
- 19
backend/views/user/index.php View File

?> ?>
<div class="user-index"> <div class="user-index">


<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?> <?= Html::a('<span class="glyphicon glyphicon-envelope"></span> Liste des emails', ['mail'], ['class' => 'btn btn-default']) ?></h1>
<h1><?= Html::encode($this->title) ?></h1>


<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'nom', 'nom',
'prenom', 'prenom',
'telephone', 'telephone',
'email',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', $url, [
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-trash"></span> Suprimer', $url, [
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default'
]);
}
],
],
'email'
], ],
]); ?> ]); ?>



Loading…
Cancel
Save