/** * removes an url wildcard * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove url wildcards * * @param \eZ\Publish\API\Repository\Values\Content\UrlWildcard $urlWildcard the url wildcard to remove */ public function remove(URLWildcard $urlWildcard) { if (false === $this->repository->canUser('content', 'edit', $urlWildcard)) { throw new UnauthorizedExceptionStub('What error code should be used?'); } unset($this->wildcards[$urlWildcard->id]); }
/** * Deletes a trash item. * * The corresponding content object will be removed * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete this trash item * * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem */ public function deleteTrashItem(TrashItem $trashItem) { if (false === $this->repository->canUser('content', 'remove', $trashItem)) { throw new UnauthorizedExceptionStub('What error code should be used?'); } unset($this->trashItems[$trashItem->id], $this->locations[$trashItem->id]); }
/** * Moves the subtree to $newParentLocation * * If a user has the permission to move the location to a target location * he can do it regardless of an existing descendant on which the user has no permission. * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException If the current user user is not allowed to move this location to the target * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the new parent is in a subtree of the location * * @param \eZ\Publish\API\Repository\Values\Content\Location $location * @param \eZ\Publish\API\Repository\Values\Content\Location $newParentLocation */ public function moveSubtree(Location $location, Location $newParentLocation) { if (false === $this->repository->canUser('content', 'move', $location, $newParentLocation)) { throw new UnauthorizedExceptionStub('What error code should be used?'); } $this->checkLocationNotInTree($location, $newParentLocation); $oldParentLocation = $this->loadLocation($location->parentLocationId); $this->moveSubtreeInternal($location, $newParentLocation); }
/** * Loads the users of a user group * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the users or user group * * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup * @param int $offset * @param int $limit * * @return \eZ\Publish\API\Repository\Values\User\User[] */ public function loadUsersOfUserGroup(UserGroup $userGroup, $offset = 0, $limit = -1) { if (false === $this->repository->canUser('content', 'read', $userGroup)) { throw new UnauthorizedExceptionStub('What error code should be used?'); } $users = array(); foreach ($this->user2groups as $userId => $userGroupIds) { if (isset($userGroupIds[$userGroup->id])) { $users[] = $this->users[$userId]; } } return $users; }
/** * Loads all incoming relations for a content object. * * The relations come only * from published versions of the source content objects * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version * * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo * * @return \eZ\Publish\API\Repository\Values\Content\Relation[] */ public function loadReverseRelations(ContentInfo $contentInfo) { if (false === $this->repository->canUser('content', 'reverserelatedlist', $contentInfo)) { throw new UnauthorizedExceptionStub('What error code should be used?'); } $relations = array(); foreach ($this->relation as $relation) { if ($relation->getDestinationContentInfo()->id === $contentInfo->id) { $relations[] = $relation; } } return $relations; }