@@ 131-150 (lines=20) @@ | ||
128 | * @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
|
129 | */ |
|
130 | $contentReadCriterion = $this->permissionsCriterionHandler->getPermissionsCriterion(); |
|
131 | if ($contentReadCriterion === false) { |
|
132 | throw new UnauthorizedException('content', 'read'); |
|
133 | } elseif ($contentReadCriterion !== true) { |
|
134 | // Query if there are any content in subtree current user don't have access to |
|
135 | $query = new Query( |
|
136 | array( |
|
137 | 'limit' => 0, |
|
138 | 'filter' => new CriterionLogicalAnd( |
|
139 | array( |
|
140 | new CriterionSubtree($loadedSubtree->pathString), |
|
141 | new CriterionLogicalNot($contentReadCriterion), |
|
142 | ) |
|
143 | ), |
|
144 | ) |
|
145 | ); |
|
146 | $result = $this->repository->getSearchService()->findContent($query, array(), false); |
|
147 | if ($result->totalCount > 0) { |
|
148 | throw new UnauthorizedException('content', 'read'); |
|
149 | } |
|
150 | } |
|
151 | ||
152 | $this->repository->beginTransaction(); |
|
153 | try { |
|
@@ 594-613 (lines=20) @@ | ||
591 | * @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
|
592 | */ |
|
593 | $contentReadCriterion = $this->permissionsCriterionHandler->getPermissionsCriterion(); |
|
594 | if ($contentReadCriterion === false) { |
|
595 | throw new UnauthorizedException('content', 'read'); |
|
596 | } elseif ($contentReadCriterion !== true) { |
|
597 | // Query if there are any content in subtree current user don't have access to |
|
598 | $query = new Query( |
|
599 | array( |
|
600 | 'limit' => 0, |
|
601 | 'filter' => new CriterionLogicalAnd( |
|
602 | array( |
|
603 | new CriterionSubtree($location->pathString), |
|
604 | new CriterionLogicalNot($contentReadCriterion), |
|
605 | ) |
|
606 | ), |
|
607 | ) |
|
608 | ); |
|
609 | $result = $this->repository->getSearchService()->findContent($query, array(), false); |
|
610 | if ($result->totalCount > 0) { |
|
611 | throw new UnauthorizedException('content', 'read'); |
|
612 | } |
|
613 | } |
|
614 | ||
615 | if (strpos($newParentLocation->pathString, $location->pathString) === 0) { |
|
616 | throw new InvalidArgumentException( |
|
@@ 673-692 (lines=20) @@ | ||
670 | * @var bool|\eZ\Publish\API\Repository\Values\Content\Query\Criterion |
|
671 | */ |
|
672 | $contentReadCriterion = $this->permissionsCriterionHandler->getPermissionsCriterion('content', 'remove'); |
|
673 | if ($contentReadCriterion === false) { |
|
674 | throw new UnauthorizedException('content', 'remove'); |
|
675 | } elseif ($contentReadCriterion !== true) { |
|
676 | // Query if there are any content in subtree current user don't have access to |
|
677 | $query = new Query( |
|
678 | array( |
|
679 | 'limit' => 0, |
|
680 | 'filter' => new CriterionLogicalAnd( |
|
681 | array( |
|
682 | new CriterionSubtree($location->pathString), |
|
683 | new CriterionLogicalNot($contentReadCriterion), |
|
684 | ) |
|
685 | ), |
|
686 | ) |
|
687 | ); |
|
688 | $result = $this->repository->getSearchService()->findContent($query, array(), false); |
|
689 | if ($result->totalCount > 0) { |
|
690 | throw new UnauthorizedException('content', 'remove'); |
|
691 | } |
|
692 | } |
|
693 | ||
694 | $this->repository->beginTransaction(); |
|
695 | try { |