use access operations to check if operation is allowed

before, this was some own code which did not same the same
check as maySetReviewerApprover()
This commit is contained in:
Uwe Steinmann 2015-06-26 12:23:09 +02:00
parent 401e995df6
commit d070f6da85

View File

@ -54,18 +54,14 @@ if(!$settings->_enableVersionModification) {
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_version_modification"));
}
// control for document state. Must correspond to check in
// SeedDMS_AccessOperation::maySetReviewersApprovers()
$overallStatus = $content->getStatus();
if ($overallStatus["status"]!=S_DRAFT_REV && $overallStatus["status"]!=S_DRAFT_APP) {
/* Create object for checking access to certain operations */
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
if (!$accessop->maySetReviewersApprovers()) {
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("cannot_assign_invalid_state"));
}
$folder = $document->getFolder();
/* Create object for checking access to certain operations */
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'version'=>$content, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp));
if($view) {