| @@ 221-234 (lines=14) @@ | ||
| 218 | * |
|
| 219 | * @return \eZ\Publish\API\Repository\Values\Content\Section |
|
| 220 | */ |
|
| 221 | public function loadSectionByIdentifier($sectionIdentifier) |
|
| 222 | { |
|
| 223 | if (!is_string($sectionIdentifier) || empty($sectionIdentifier)) { |
|
| 224 | throw new InvalidArgumentValue('sectionIdentifier', $sectionIdentifier); |
|
| 225 | } |
|
| 226 | ||
| 227 | if ($this->repository->hasAccess('section', 'view') !== true) { |
|
| 228 | throw new UnauthorizedException('section', 'view'); |
|
| 229 | } |
|
| 230 | ||
| 231 | $spiSection = $this->sectionHandler->loadByIdentifier($sectionIdentifier); |
|
| 232 | ||
| 233 | return $this->buildDomainSectionObject($spiSection); |
|
| 234 | } |
|
| 235 | ||
| 236 | /** |
|
| 237 | * Counts the contents which $section is assigned to. |
|
| @@ 777-790 (lines=14) @@ | ||
| 774 | * |
|
| 775 | * @return \eZ\Publish\API\Repository\Values\User\Role |
|
| 776 | */ |
|
| 777 | public function loadRoleByIdentifier($identifier) |
|
| 778 | { |
|
| 779 | if (!is_string($identifier)) { |
|
| 780 | throw new InvalidArgumentValue('identifier', $identifier); |
|
| 781 | } |
|
| 782 | ||
| 783 | if ($this->repository->hasAccess('role', 'read') !== true) { |
|
| 784 | throw new UnauthorizedException('role', 'read'); |
|
| 785 | } |
|
| 786 | ||
| 787 | $spiRole = $this->userHandler->loadRoleByIdentifier($identifier); |
|
| 788 | ||
| 789 | return $this->roleDomainMapper->buildDomainRoleObject($spiRole); |
|
| 790 | } |
|
| 791 | ||
| 792 | /** |
|
| 793 | * Loads all roles. |
|