|
@@ 145-164 (lines=20) @@
|
| 142 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 143 |
|
*/ |
| 144 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion(); |
| 145 |
|
if ($contentReadCriterion === false) { |
| 146 |
|
throw new UnauthorizedException('content', 'read'); |
| 147 |
|
} elseif ($contentReadCriterion !== true) { |
| 148 |
|
// Query if there are any content in subtree current user don't have access to |
| 149 |
|
$query = new Query( |
| 150 |
|
array( |
| 151 |
|
'limit' => 0, |
| 152 |
|
'filter' => new CriterionLogicalAnd( |
| 153 |
|
array( |
| 154 |
|
new CriterionSubtree($loadedSubtree->pathString), |
| 155 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 156 |
|
) |
| 157 |
|
), |
| 158 |
|
) |
| 159 |
|
); |
| 160 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 161 |
|
if ($result->totalCount > 0) { |
| 162 |
|
throw new UnauthorizedException('content', 'read'); |
| 163 |
|
} |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
$this->repository->beginTransaction(); |
| 167 |
|
try { |
|
@@ 638-657 (lines=20) @@
|
| 635 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 636 |
|
*/ |
| 637 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion(); |
| 638 |
|
if ($contentReadCriterion === false) { |
| 639 |
|
throw new UnauthorizedException('content', 'read'); |
| 640 |
|
} elseif ($contentReadCriterion !== true) { |
| 641 |
|
// Query if there are any content in subtree current user don't have access to |
| 642 |
|
$query = new Query( |
| 643 |
|
array( |
| 644 |
|
'limit' => 0, |
| 645 |
|
'filter' => new CriterionLogicalAnd( |
| 646 |
|
array( |
| 647 |
|
new CriterionSubtree($location->pathString), |
| 648 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 649 |
|
) |
| 650 |
|
), |
| 651 |
|
) |
| 652 |
|
); |
| 653 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 654 |
|
if ($result->totalCount > 0) { |
| 655 |
|
throw new UnauthorizedException('content', 'read'); |
| 656 |
|
} |
| 657 |
|
} |
| 658 |
|
|
| 659 |
|
if (strpos($newParentLocation->pathString, $location->pathString) === 0) { |
| 660 |
|
throw new InvalidArgumentException( |
|
@@ 717-736 (lines=20) @@
|
| 714 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 715 |
|
*/ |
| 716 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'remove'); |
| 717 |
|
if ($contentReadCriterion === false) { |
| 718 |
|
throw new UnauthorizedException('content', 'remove'); |
| 719 |
|
} elseif ($contentReadCriterion !== true) { |
| 720 |
|
// Query if there are any content in subtree current user don't have access to |
| 721 |
|
$query = new Query( |
| 722 |
|
array( |
| 723 |
|
'limit' => 0, |
| 724 |
|
'filter' => new CriterionLogicalAnd( |
| 725 |
|
array( |
| 726 |
|
new CriterionSubtree($location->pathString), |
| 727 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 728 |
|
) |
| 729 |
|
), |
| 730 |
|
) |
| 731 |
|
); |
| 732 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 733 |
|
if ($result->totalCount > 0) { |
| 734 |
|
throw new UnauthorizedException('content', 'remove'); |
| 735 |
|
} |
| 736 |
|
} |
| 737 |
|
|
| 738 |
|
$this->repository->beginTransaction(); |
| 739 |
|
try { |