|
@@ 301-316 (lines=16) @@
|
| 298 |
|
/** |
| 299 |
|
* {@inheritdoc} |
| 300 |
|
*/ |
| 301 |
|
public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
| 302 |
|
{ |
| 303 |
|
$content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable); |
| 304 |
|
|
| 305 |
|
if (!$this->repository->canUser('content', 'read', $content)) { |
| 306 |
|
throw new UnauthorizedException('content', 'read', ['contentId' => $contentId]); |
| 307 |
|
} |
| 308 |
|
if ( |
| 309 |
|
!$content->getVersionInfo()->isPublished() |
| 310 |
|
&& !$this->repository->canUser('content', 'versionread', $content) |
| 311 |
|
) { |
| 312 |
|
throw new UnauthorizedException('content', 'versionread', ['contentId' => $contentId, 'versionNo' => $versionNo]); |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
return $content; |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
/** |
| 319 |
|
* Loads content in a version of the given content object. |
|
@@ 401-417 (lines=17) @@
|
| 398 |
|
* |
| 399 |
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
| 400 |
|
*/ |
| 401 |
|
public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
| 402 |
|
{ |
| 403 |
|
$content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable); |
| 404 |
|
|
| 405 |
|
if (!$this->repository->canUser('content', 'read', $content)) { |
| 406 |
|
throw new UnauthorizedException('content', 'read', ['remoteId' => $remoteId]); |
| 407 |
|
} |
| 408 |
|
|
| 409 |
|
if ( |
| 410 |
|
!$content->getVersionInfo()->isPublished() |
| 411 |
|
&& !$this->repository->canUser('content', 'versionread', $content) |
| 412 |
|
) { |
| 413 |
|
throw new UnauthorizedException('content', 'versionread', ['remoteId' => $remoteId, 'versionNo' => $versionNo]); |
| 414 |
|
} |
| 415 |
|
|
| 416 |
|
return $content; |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
/** |
| 420 |
|
* Bulk-load Content items by the list of ContentInfo Value Objects. |