src/Controllers/HistoryViewerController.php
protected function getRecordVersion($recordClass, $recordId, $recordVersion)
    {
        $record = Versioned::get_version($recordClass, $recordId, $recordVersion);

        if (!$record) {
            $this->jsonError(404);
            return null;
        }

        if (!$record->canView()) {
            $this->jsonError(403, _t(
                __CLASS__.'.ErrorItemViewPermissionDenied',
                "You don't have the necessary permissions to view {ObjectTitle}",
                ['ObjectTitle' => $record->i18n_singular_name()]
            ));
            return null;
        }

        return $record;
    }
protected function getRecordVersion($recordClass, $recordId, $recordVersion)
    {
        $record = Versioned::get_version($recordClass, $recordId, $recordVersion);

        if (!$record) {
            $this->jsonError(404);
            return null;
        }

        if (!$record->canView()) {
            $this->jsonError(403, _t(
                __CLASS__.'.ErrorItemViewPermissionDenied',
                "You don't have the necessary permissions to view {ObjectTitle}",
                ['ObjectTitle' => $record->i18n_singular_name()]
            ));
            return null;
        }

        return $record;
    }
protected function getRecordVersion ( $ recordClass , $ recordId , $ recordVersion ) { $ record = Versioned :: get_version ( $ recordClass , $ recordId , $ recordVersion ) ; if ( ! $ record ) { $ this -> jsonError ( 404 ) ; return null ; } if ( ! $ record -> canView ( ) ) { $ this -> jsonError ( 403 , _t ( __CLASS__ . '.ErrorItemViewPermissionDenied' , "You don't have the necessary permissions to view {ObjectTitle}" , [ 'ObjectTitle' => $ record -> i18n_singular_name ( ) ] ) ) ; return null ; } return $ record ; }
Fetches record version and checks canView permission for result

@param string $recordClass
@param int $recordId
@param int $recordVersion
@return DataObject|null
Fetches record version and checks canView permission for result