| @@ 834-847 (lines=14) @@ | ||
| 831 | * |
|
| 832 | * @return \eZ\Publish\API\Repository\Values\User\Role |
|
| 833 | */ |
|
| 834 | public function loadRoleByIdentifier($identifier) |
|
| 835 | { |
|
| 836 | if (!is_string($identifier)) { |
|
| 837 | throw new InvalidArgumentValue('identifier', $identifier); |
|
| 838 | } |
|
| 839 | ||
| 840 | if ($this->repository->hasAccess('role', 'read') !== true) { |
|
| 841 | throw new UnauthorizedException('role', 'read'); |
|
| 842 | } |
|
| 843 | ||
| 844 | $spiRole = $this->userHandler->loadRoleByIdentifier($identifier); |
|
| 845 | ||
| 846 | return $this->roleDomainMapper->buildDomainRoleObject($spiRole); |
|
| 847 | } |
|
| 848 | ||
| 849 | /** |
|
| 850 | * Loads all roles. |
|
| @@ 223-236 (lines=14) @@ | ||
| 220 | * |
|
| 221 | * @return \eZ\Publish\API\Repository\Values\Content\Section |
|
| 222 | */ |
|
| 223 | public function loadSectionByIdentifier($sectionIdentifier) |
|
| 224 | { |
|
| 225 | if (!is_string($sectionIdentifier) || empty($sectionIdentifier)) { |
|
| 226 | throw new InvalidArgumentValue('sectionIdentifier', $sectionIdentifier); |
|
| 227 | } |
|
| 228 | ||
| 229 | if ($this->repository->hasAccess('section', 'view') !== true) { |
|
| 230 | throw new UnauthorizedException('section', 'view'); |
|
| 231 | } |
|
| 232 | ||
| 233 | $spiSection = $this->sectionHandler->loadByIdentifier($sectionIdentifier); |
|
| 234 | ||
| 235 | return $this->buildDomainSectionObject($spiSection); |
|
| 236 | } |
|
| 237 | ||
| 238 | /** |
|
| 239 | * Counts the contents which $section is assigned to. |
|