HandlerPageView: Add misisng check whether passed revision is most recent

This commit is contained in:
Albert S. 2021-03-16 21:05:59 +01:00
부모 e4562809a0
커밋 2aa11fc2b2
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제

파일 보기

@ -92,7 +92,11 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename,
{
if(!effectivePermissions(pagename).canSeePageHistory())
{
return errorResponse("Error", "You are not allowed to view older revisions of this page");
auto current = this->database->createRevisionDao()->getCurrentForPage(pagename);
if(current && current->revision > revisionid)
{
return errorResponse("Error", "You are not allowed to view older revisions of this page");
}
}
revision = this->database->createRevisionDao()->getRevisionForPage(pagename, revisionid);
if(!revision)