add role to user

This commit is contained in:
2015-11-05 09:26:08 +01:00
parent bdd5a94b3f
commit 43d5598f23
9 changed files with 151 additions and 17 deletions

View File

@@ -2,6 +2,7 @@
use yii\helpers\Html;
use yii\grid\GridView;
use common\components\RoleDefinition;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\UserSearch */
@@ -28,6 +29,15 @@ $this->params['breadcrumbs'][] = $this->title;
'email:email',
'created_at:datetime',
[
'attribute' => 'role',
'value' => function ($model){
$roles = \Yii::$app->authManager->getRolesByUser($model->id );
return implode(', ', array_map(function ($role) { return sprintf("%s", RoleDefinition::getRoleLabel($role->name)); }, $roles ));
}
] ,
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'
],