diff --git a/views/admin/index.php b/views/admin/index.php index 748e1af47..90fc9575c 100644 --- a/views/admin/index.php +++ b/views/admin/index.php @@ -117,7 +117,7 @@ 'template' => '{switch} {resend_password} {update} {delete}', 'buttons' => [ 'resend_password' => function ($url, $model, $key) { - if ($model->isAdmin) { + if (\Yii::$app->user->identity->isAdmin && !$model->isAdmin) { return ' @@ -125,7 +125,7 @@ } }, 'switch' => function ($url, $model) { - if($model->isAdmin && $model->id != Yii::$app->user->id && Yii::$app->getModule('user')->enableImpersonateUser) { + if(\Yii::$app->user->identity->isAdmin && $model->id != Yii::$app->user->id && Yii::$app->getModule('user')->enableImpersonateUser) { return Html::a('', ['/user/admin/switch', 'id' => $model->id], [ 'title' => Yii::t('user', 'Become this user'), 'data-confirm' => Yii::t('user', 'Are you sure you want to switch to this user for the rest of this Session?'),