I am using Yii2 advanced template
and I have a gridview
to display users and in the action
column I have added a button to disable users.
The default actions work correctly, but I get Forbidden (#403)
error when I click on the action I made myself.
my gridview action buttons:
[
'class' => 'kartik\grid\ActionColumn',
'template' => '{view} {update} {delete} {disable}',
'buttons' =>[
'disable' => function($url, $model, $key)
{
return Html::a("" ,$url, ['class' => "glyphicon glyphicon-ban-circle"]);
}
]
],
The $url
for disable button is site.com/admin/user-register/disable?id=57
and I have actionDisable
in UserRegisterController
my actionDisable
:
public function actionDisable($id)
{
if (Yii::$app->user->can('EditMobileUser')) {
echo "disable";
} else throw new NotFoundHttpException();
}