Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
a9493725ef
2 değiştirilmiş dosya ile 10 ekleme ve 21 silme
  1. +8
    -2
      backend/controllers/UserController.php
  2. +2
    -19
      backend/views/user/index.php

+ 8
- 2
backend/controllers/UserController.php Dosyayı Görüntüle

@@ -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 Dosyayı Görüntüle

@@ -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'
],
]); ?>


Yükleniyor…
İptal
Kaydet