/** * Loads a role for the given identifier * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a role with the given name was not found * * @param string $identifier * * @return \eZ\Publish\API\Repository\Values\User\Role */ public function loadRoleByIdentifier($identifier) { if (!is_string($identifier)) { throw new InvalidArgumentValue("identifier", $identifier); } if ($this->repository->hasAccess('role', 'read') !== true) { throw new UnauthorizedException('role', 'read'); } $spiRole = $this->userHandler->loadRoleByIdentifier($identifier); return $this->buildDomainRoleObject($spiRole); }