set dms in view early, check for access on latest content

This commit is contained in:
Uwe Steinmann 2016-04-26 18:14:38 +02:00
parent f87a3ce570
commit 6b2d4a4b75

View File

@ -35,7 +35,7 @@ include("../inc/inc.Authentication.php");
require_once("SeedDMS/Preview.php"); require_once("SeedDMS/Preview.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1]); $view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings); $accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) { if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
@ -53,6 +53,11 @@ if ($document->getAccessMode($user) < M_READ) {
$view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); $view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
} }
/* Could be that the advanced access rights prohibit access on the content */
if (!$document->getLatestContent()) {
$view->exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
}
/* Recalculate the status of a document and reload the page if the status /* Recalculate the status of a document and reload the page if the status
* has changed. A status change may occur if the document has expired in * has changed. A status change may occur if the document has expired in
* the mean time * the mean time
@ -69,8 +74,6 @@ if ($document->checkForDueRevisionWorkflow($user)){
} }
if($view) { if($view) {
$view->setParam('dms', $dms);
$view->setParam('user', $user);
$view->setParam('folder', $folder); $view->setParam('folder', $folder);
$view->setParam('document', $document); $view->setParam('document', $document);
$view->setParam('accessobject', $accessop); $view->setParam('accessobject', $accessop);