| @@ 325-339 (lines=15) @@ | ||
| 322 | * |
|
| 323 | * @return \eZ\Publish\SPI\Persistence\User\Role |
|
| 324 | */ |
|
| 325 | public function loadRole($roleId, $status = Role::STATUS_DEFINED) |
|
| 326 | { |
|
| 327 | $data = $this->roleGateway->loadRole($roleId, $status); |
|
| 328 | ||
| 329 | if (empty($data)) { |
|
| 330 | throw new RoleNotFound($roleId, $status); |
|
| 331 | } |
|
| 332 | ||
| 333 | $role = $this->mapper->mapRole($data); |
|
| 334 | foreach ($role->policies as $policy) { |
|
| 335 | $this->limitationConverter->toSPI($policy); |
|
| 336 | } |
|
| 337 | ||
| 338 | return $role; |
|
| 339 | } |
|
| 340 | ||
| 341 | /** |
|
| 342 | * Loads a specified role (draft) by $identifier and $status. |
|
| @@ 351-365 (lines=15) @@ | ||
| 348 | * |
|
| 349 | * @return \eZ\Publish\SPI\Persistence\User\Role |
|
| 350 | */ |
|
| 351 | public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED) |
|
| 352 | { |
|
| 353 | $data = $this->roleGateway->loadRoleByIdentifier($identifier, $status); |
|
| 354 | ||
| 355 | if (empty($data)) { |
|
| 356 | throw new RoleNotFound($identifier, $status); |
|
| 357 | } |
|
| 358 | ||
| 359 | $role = $this->mapper->mapRole($data); |
|
| 360 | foreach ($role->policies as $policy) { |
|
| 361 | $this->limitationConverter->toSPI($policy); |
|
| 362 | } |
|
| 363 | ||
| 364 | return $role; |
|
| 365 | } |
|
| 366 | ||
| 367 | /** |
|
| 368 | * Loads a role draft by the original role ID. |
|
| @@ 376-390 (lines=15) @@ | ||
| 373 | * |
|
| 374 | * @return \eZ\Publish\SPI\Persistence\User\Role |
|
| 375 | */ |
|
| 376 | public function loadRoleDraftByRoleId($roleId) |
|
| 377 | { |
|
| 378 | $data = $this->roleGateway->loadRoleDraftByRoleId($roleId); |
|
| 379 | ||
| 380 | if (empty($data)) { |
|
| 381 | throw new RoleNotFound($roleId, Role::STATUS_DRAFT); |
|
| 382 | } |
|
| 383 | ||
| 384 | $role = $this->mapper->mapRole($data); |
|
| 385 | foreach ($role->policies as $policy) { |
|
| 386 | $this->limitationConverter->toSPI($policy); |
|
| 387 | } |
|
| 388 | ||
| 389 | return $role; |
|
| 390 | } |
|
| 391 | ||
| 392 | /** |
|
| 393 | * Loads all roles. |
|