|
@@ 144-163 (lines=20) @@
|
| 141 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 142 |
|
*/ |
| 143 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion(); |
| 144 |
|
if ($contentReadCriterion === false) { |
| 145 |
|
throw new UnauthorizedException('content', 'read'); |
| 146 |
|
} elseif ($contentReadCriterion !== true) { |
| 147 |
|
// Query if there are any content in subtree current user don't have access to |
| 148 |
|
$query = new Query( |
| 149 |
|
array( |
| 150 |
|
'limit' => 0, |
| 151 |
|
'filter' => new CriterionLogicalAnd( |
| 152 |
|
array( |
| 153 |
|
new CriterionSubtree($loadedSubtree->pathString), |
| 154 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 155 |
|
) |
| 156 |
|
), |
| 157 |
|
) |
| 158 |
|
); |
| 159 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 160 |
|
if ($result->totalCount > 0) { |
| 161 |
|
throw new UnauthorizedException('content', 'read'); |
| 162 |
|
} |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
$this->repository->beginTransaction(); |
| 166 |
|
try { |
|
@@ 612-631 (lines=20) @@
|
| 609 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 610 |
|
*/ |
| 611 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion(); |
| 612 |
|
if ($contentReadCriterion === false) { |
| 613 |
|
throw new UnauthorizedException('content', 'read'); |
| 614 |
|
} elseif ($contentReadCriterion !== true) { |
| 615 |
|
// Query if there are any content in subtree current user don't have access to |
| 616 |
|
$query = new Query( |
| 617 |
|
array( |
| 618 |
|
'limit' => 0, |
| 619 |
|
'filter' => new CriterionLogicalAnd( |
| 620 |
|
array( |
| 621 |
|
new CriterionSubtree($location->pathString), |
| 622 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 623 |
|
) |
| 624 |
|
), |
| 625 |
|
) |
| 626 |
|
); |
| 627 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 628 |
|
if ($result->totalCount > 0) { |
| 629 |
|
throw new UnauthorizedException('content', 'read'); |
| 630 |
|
} |
| 631 |
|
} |
| 632 |
|
|
| 633 |
|
if (strpos($newParentLocation->pathString, $location->pathString) === 0) { |
| 634 |
|
throw new InvalidArgumentException( |
|
@@ 691-710 (lines=20) @@
|
| 688 |
|
* @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
| 689 |
|
*/ |
| 690 |
|
$contentReadCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'remove'); |
| 691 |
|
if ($contentReadCriterion === false) { |
| 692 |
|
throw new UnauthorizedException('content', 'remove'); |
| 693 |
|
} elseif ($contentReadCriterion !== true) { |
| 694 |
|
// Query if there are any content in subtree current user don't have access to |
| 695 |
|
$query = new Query( |
| 696 |
|
array( |
| 697 |
|
'limit' => 0, |
| 698 |
|
'filter' => new CriterionLogicalAnd( |
| 699 |
|
array( |
| 700 |
|
new CriterionSubtree($location->pathString), |
| 701 |
|
new CriterionLogicalNot($contentReadCriterion), |
| 702 |
|
) |
| 703 |
|
), |
| 704 |
|
) |
| 705 |
|
); |
| 706 |
|
$result = $this->repository->getSearchService()->findContent($query, array(), false); |
| 707 |
|
if ($result->totalCount > 0) { |
| 708 |
|
throw new UnauthorizedException('content', 'remove'); |
| 709 |
|
} |
| 710 |
|
} |
| 711 |
|
|
| 712 |
|
$this->repository->beginTransaction(); |
| 713 |
|
try { |