public function publishVersion(APIVersionInfo $versionInfo)
{
$content = $this->internalLoadContent($versionInfo->contentInfo->id, null, $versionInfo->versionNo);
if (!$content->getVersionInfo()->getContentInfo()->published) {
if (!$this->repository->canUser('content', 'create', $content)) {
throw new UnauthorizedException('content', 'create', array('contentId' => $content->id));
}
} elseif (!$this->repository->canUser('content', 'edit', $content)) {
throw new UnauthorizedException('content', 'edit', array('contentId' => $content->id));
}
$this->repository->beginTransaction();
try {
$content = $this->internalPublishVersion($content->getVersionInfo());
$this->repository->commit();
} catch (Exception $e) {
$this->repository->rollback();
throw $e;
}
return $content;
}