/** * @param Client $client * @return array */ public function getClientScope(Client $client) { $authorizations = $this->getAuthorizations(); foreach ($authorizations as $auth) { $c = $auth->getClient(); if ($c->getId() == $client->getId()) { return $auth->getScope(); } } return null; }
/** * Checks if a given Client can access this Person's specified scope. * @param \PROCERGS\OAuthBundle\Entity\Client $client * @param mixed $scope can be a single scope or an array with several. * @return boolean */ public function isAuthorizedClient(Client $client, $scope) { $authorizations = $this->getAuthorizations(); foreach ($authorizations as $auth) { $c = $auth->getClient(); if ($c->getId() == $client->getId()) { return $auth->hasScopes($scope); } } return false; }