public function loadContentDrafts(User $user = null)
    {
        if ($user === null) {
            $user = $this->repository->getCurrentUserReference();
        }

        // throw early if user has absolutely no access to versionread
        if ($this->repository->hasAccess('content', 'versionread') === false) {
            throw new UnauthorizedException('content', 'versionread');
        }

        $spiVersionInfoList = $this->persistenceHandler->contentHandler()->loadDraftsForUser($user->getUserId());
        $versionInfoList = array();
        foreach ($spiVersionInfoList as $spiVersionInfo) {
            $versionInfo = $this->domainMapper->buildVersionInfoDomainObject($spiVersionInfo);
            // @todo: Change this to filter returned drafts by permissions instead of throwing
            if (!$this->repository->canUser('content', 'versionread', $versionInfo)) {
                throw new UnauthorizedException('content', 'versionread', array('contentId' => $versionInfo->contentInfo->id));
            }

            $versionInfoList[] = $versionInfo;
        }

        return $versionInfoList;
    }
public function loadContentDrafts(User $user = null)
    {
        if ($user === null) {
            $user = $this->repository->getCurrentUserReference();
        }

        // throw early if user has absolutely no access to versionread
        if ($this->repository->hasAccess('content', 'versionread') === false) {
            throw new UnauthorizedException('content', 'versionread');
        }

        $spiVersionInfoList = $this->persistenceHandler->contentHandler()->loadDraftsForUser($user->getUserId());
        $versionInfoList = array();
        foreach ($spiVersionInfoList as $spiVersionInfo) {
            $versionInfo = $this->domainMapper->buildVersionInfoDomainObject($spiVersionInfo);
            // @todo: Change this to filter returned drafts by permissions instead of throwing
            if (!$this->repository->canUser('content', 'versionread', $versionInfo)) {
                throw new UnauthorizedException('content', 'versionread', array('contentId' => $versionInfo->contentInfo->id));
            }

            $versionInfoList[] = $versionInfo;
        }

        return $versionInfoList;
    }
public function loadContentDrafts ( User $ user = null ) { if ( $ user === null ) { $ user = $ this -> repository -> getCurrentUserReference ( ) ; } // throw early if user has absolutely no access to versionread if ( $ this -> repository -> hasAccess ( 'content' , 'versionread' ) === false ) { throw new UnauthorizedException ( 'content' , 'versionread' ) ; } $ spiVersionInfoList = $ this -> persistenceHandler -> contentHandler ( ) -> loadDraftsForUser ( $ user -> getUserId ( ) ) ; $ versionInfoList = array ( ) ; foreach ( $ spiVersionInfoList as $ spiVersionInfo ) { $ versionInfo = $ this -> domainMapper -> buildVersionInfoDomainObject ( $ spiVersionInfo ) ; // @todo: Change this to filter returned drafts by permissions instead of throwing if ( ! $ this -> repository -> canUser ( 'content' , 'versionread' , $ versionInfo ) ) { throw new UnauthorizedException ( 'content' , 'versionread' , array ( 'contentId' => $ versionInfo -> contentInfo -> id ) ) ; } $ versionInfoList [ ] = $ versionInfo ; } return $ versionInfoList ; }
Loads drafts for a user.

If no user is given the drafts for the authenticated user a returned

@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the current-user is not allowed to load the draft list

@param \eZ\Publish\API\Repository\Values\User\UserReference $user

@return \eZ\Publish\API\Repository\Values\Content\VersionInfo the drafts ({@link VersionInfo}) owned by the given user
Loads drafts for a user .