Skip to content

Commit 573a7b9

Browse files
committed
fix isAdmin in admin/index action
1 parent f8a6373 commit 573a7b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

views/admin/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@
117117
'template' => '{switch} {resend_password} {update} {delete}',
118118
'buttons' => [
119119
'resend_password' => function ($url, $model, $key) {
120-
if ($model->isAdmin) {
120+
if (\Yii::$app->user->identity->isAdmin && !$model->isAdmin) {
121121
return '
122122
<a data-method="POST" data-confirm="' . Yii::t('user', 'Are you sure?') . '" href="' . Url::to(['resend-password', 'id' => $model->id]) . '">
123123
<span title="' . Yii::t('user', 'Generate and send new password to user') . '" class="glyphicon glyphicon-envelope">
124124
</span> </a>';
125125
}
126126
},
127127
'switch' => function ($url, $model) {
128-
if($model->isAdmin && $model->id != Yii::$app->user->id && Yii::$app->getModule('user')->enableImpersonateUser) {
128+
if(\Yii::$app->user->identity->isAdmin && $model->id != Yii::$app->user->id && Yii::$app->getModule('user')->enableImpersonateUser) {
129129
return Html::a('<span class="glyphicon glyphicon-user"></span>', ['/user/admin/switch', 'id' => $model->id], [
130130
'title' => Yii::t('user', 'Become this user'),
131131
'data-confirm' => Yii::t('user', 'Are you sure you want to switch to this user for the rest of this Session?'),

0 commit comments

Comments
 (0)