document must be readable to be reviewed or approved

This commit is contained in:
Uwe Steinmann 2023-06-19 17:31:08 +02:00
parent 64a7d341eb
commit 77474bdaee
2 changed files with 11 additions and 7 deletions

View File

@ -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))

View File

@ -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)) {