diff --git a/op/op.ApproveDocument.php b/op/op.ApproveDocument.php index c3edd575f..8e365e022 100644 --- a/op/op.ApproveDocument.php +++ b/op/op.ApproveDocument.php @@ -50,8 +50,7 @@ if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } -// verify if document may be approved -if (!$accessop->mayApprove($document)){ +if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); } @@ -74,7 +73,10 @@ if ($latestContent->getVersion()!=$version) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); } -$olddocstatus = $content->getStatus(); +// verify if document may be approved +if (!$accessop->mayApprove()){ + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} if (!isset($_POST["approvalStatus"]) || !is_numeric($_POST["approvalStatus"]) || (intval($_POST["approvalStatus"])!=1 && intval($_POST["approvalStatus"])!=-1)) { @@ -92,7 +94,7 @@ $controller->setParam('type', $_POST['approvalType']); $controller->setParam('status', $_POST['approvalStatus']); $controller->setParam('content', $latestContent); $controller->setParam('file', !empty($_FILES["approvalfile"]["tmp_name"]) ? $_FILES["approvalfile"]["tmp_name"] : ''); -$controller->setParam('group', !empty($_POST['approvalGroup']) ? $dms->getGroup($_POST['approvalGroup']) : null); +$controller->setParam('group', !empty($_POST['approvalGroup']) ? $dms->getGroup($_POST['approvalGroup']) : null); if(!$controller()) { $err = $controller->getErrorMsg(); if(is_string($err)) diff --git a/op/op.ReviewDocument.php b/op/op.ReviewDocument.php index b25d46316..cf32a4d46 100644 --- a/op/op.ReviewDocument.php +++ b/op/op.ReviewDocument.php @@ -50,8 +50,7 @@ if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } -// verify if document may be reviewed -if (!$accessop->mayReview($document)){ +if ($document->getAccessMode($user) < M_READ) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); } @@ -74,7 +73,10 @@ if ($latestContent->getVersion()!=$version) { UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_version")); } -$olddocstatus = $content->getStatus(); +// verify if document may be reviewed +if (!$accessop->mayReview()){ + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied")); +} if (!isset($_POST["reviewStatus"]) || !is_numeric($_POST["reviewStatus"]) || (intval($_POST["reviewStatus"])!=1 && intval($_POST["reviewStatus"])!=-1)) {