name === P::VIEW_OWN_OAUTH_CLIENTS) { return (new AccountOwner())->execute($accessToken, $item, ['accountId' => $accountId]); } $clientId = $params['clientId'] ?? null; if ($clientId === null) { return false; } /** @var OauthClient|null $client */ $client = OauthClient::findOne($clientId); if ($client === null) { return false; } $identity = Yii::$app->user->findIdentityByAccessToken($accessToken); if ($identity === null) { return false; } $account = $identity->getAccount(); if ($account === null) { return false; } if ($account->id !== $client->account_id) { return false; } return true; } }