Sfoglia il codice sorgente

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 anni fa
parent
commit
a9493725ef
2 ha cambiato i file con 10 aggiunte e 21 eliminazioni
  1. +8
    -2
      backend/controllers/UserController.php
  2. +2
    -19
      backend/views/user/index.php

+ 8
- 2
backend/controllers/UserController.php Vedi 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 Vedi 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…
Annulla
Salva