/** * Loads a specified role (draft) by $identifier and $status. * * @param string $identifier * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If role is not found * * @return \eZ\Publish\SPI\Persistence\User\Role */ public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED) { $data = $this->roleGateway->loadRoleByIdentifier($identifier, $status); if (empty($data)) { throw new RoleNotFound($identifier, $status); } $role = $this->mapper->mapRole($data); foreach ($role->policies as $policy) { $this->limitationConverter->toSPI($policy); } return $role; }
/** * Loads a role draft by the original role ID. * * @param mixed $roleId ID of the role the draft was created from. * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If role is not found * * @return \eZ\Publish\SPI\Persistence\User\Role */ public function loadRoleDraftByRoleId($roleId) { $data = $this->roleGateway->loadRoleDraftByRoleId($roleId); if (empty($data)) { throw new RoleNotFound($roleId, Role::STATUS_DRAFT); } $role = $this->mapper->mapRole($data); foreach ($role->policies as $policy) { $this->limitationConverter->toSPI($policy); } return $role; }
/** * Loads a specified role by $identifier. * * @param string $identifier * * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If role is not found * * @return \eZ\Publish\SPI\Persistence\User\Role */ public function loadRoleByIdentifier($identifier) { $data = $this->roleGateway->loadRoleByIdentifier($identifier); if (empty($data)) { throw new NotFound('role', $identifier); } $role = $this->mapper->mapRole($data); foreach ($role->policies as $policy) { $this->limitationConverter->toSPI($policy); } return $role; }