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