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.
prodstable
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

@@ -33,8 +33,14 @@ class UserController extends Controller
'allow' => true,
'roles' => ['@'],
'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

@@ -11,7 +11,7 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<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([
'dataProvider' => $dataProvider,
@@ -19,24 +19,7 @@ $this->params['breadcrumbs'][] = $this->title;
'nom',
'prenom',
'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