Без кода мы всё равно не скажем, где ошибка. Непонятно почему приходится выпытывать эту информацию.
<?php
namespace app\modules\api\controllers;
use yii\rest\ActiveController;
use yii\filters\auth\HttpBearerAuth;
use Yii;
/**
* Default controller for the `admin` module
*/
class UserController extends ActiveController
{
public $modelClass = 'app\models\User';
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => HttpBearerAuth::className(),
];
$behaviors['contentNegotiator'] = [
'class' => \yii\filters\ContentNegotiator::className(),
'formats' => [
'application/json' => \yii\web\Response::FORMAT_JSON,
]
];
$behaviors['access'] = [
'class' => 'mdm\admin\components\AccessControl',
'only' => ['update', 'delete'],
];
return $behaviors;
}
protected function verbs()
{
return [
'index' => ['GET', 'HEAD'],
'signin' => ['GET', 'HEAD'],
'create' => ['POST'],
'update' => ['GET', 'PUT', 'PATCH'],
'delete' => ['DELETE'],
];
}
public function checkAccess($action, $model = null, $params = [])
{
throw new \yii\web\ForbiddenHttpException(sprintf('You can only %s lease that you\'ve created.', $action));
}
public function actionSignin()
{
return ['sdsd' => 'sdsd'];
// Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
// return User::findIdentity(Yii::$app->user->identity->id);
}
}