|
@@ 309-324 (lines=16) @@
|
| 306 |
|
/** |
| 307 |
|
* {@inheritdoc} |
| 308 |
|
*/ |
| 309 |
|
public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
| 310 |
|
{ |
| 311 |
|
$content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable); |
| 312 |
|
|
| 313 |
|
if (!$this->repository->canUser('content', 'read', $content)) { |
| 314 |
|
throw new UnauthorizedException('content', 'read', array('contentId' => $contentId)); |
| 315 |
|
} |
| 316 |
|
if ( |
| 317 |
|
!$content->getVersionInfo()->isPublished() |
| 318 |
|
&& !$this->repository->canUser('content', 'versionread', $content) |
| 319 |
|
) { |
| 320 |
|
throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo)); |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
return $content; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
/** |
| 327 |
|
* Loads content in a version of the given content object. |
|
@@ 415-431 (lines=17) @@
|
| 412 |
|
* |
| 413 |
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
| 414 |
|
*/ |
| 415 |
|
public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
| 416 |
|
{ |
| 417 |
|
$content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable); |
| 418 |
|
|
| 419 |
|
if (!$this->repository->canUser('content', 'read', $content)) { |
| 420 |
|
throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId)); |
| 421 |
|
} |
| 422 |
|
|
| 423 |
|
if ( |
| 424 |
|
!$content->getVersionInfo()->isPublished() |
| 425 |
|
&& !$this->repository->canUser('content', 'versionread', $content) |
| 426 |
|
) { |
| 427 |
|
throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo)); |
| 428 |
|
} |
| 429 |
|
|
| 430 |
|
return $content; |
| 431 |
|
} |
| 432 |
|
|
| 433 |
|
/** |
| 434 |
|
* Creates a new content draft assigned to the authenticated user. |