mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
check if document is locked
This commit is contained in:
parent
010179fc98
commit
51b84868a6
|
@ -43,13 +43,17 @@ if (!is_object($document)) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
$docPathHTML = getFolderPathHTML($folder, true). " / <a href=\"../out/out.ViewDocument.php?documentid=".$documentid."\">".$document->getName()."</a>";
|
||||
|
||||
if ($document->getAccessMode($user) < M_READWRITE) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$versionid = $_POST["version"];
|
||||
$version = $document->getContentByVersion($versionid);
|
||||
|
||||
|
@ -63,6 +67,7 @@ if (($oldcomment = $version->getComment()) != $comment) {
|
|||
if($version->setComment($comment)) {
|
||||
if($notifier) {
|
||||
$notifyList = $document->getNotifyList();
|
||||
$folder = $document->getFolder();
|
||||
|
||||
/*
|
||||
$subject = "###SITENAME###: ".$document->getName().", v.".$version->_version." - ".getMLText("document_comment_changed_email");
|
||||
|
|
|
@ -44,6 +44,13 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$name = $_POST["name"];
|
||||
$comment = $_POST["comment"];
|
||||
$keywords = $_POST["keywords"];
|
||||
|
|
|
@ -53,6 +53,13 @@ if (($document->getAccessMode($user) < M_READWRITE) || ($targetFolder->getAccess
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
if ($targetid != $oldFolder->getID()) {
|
||||
if ($document->setFolder($targetFolder)) {
|
||||
// Send notification to subscribers.
|
||||
|
|
|
@ -44,6 +44,13 @@ if ($document->getAccessMode($user) < M_ALL) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
/* Get the notify list before removing the document */
|
||||
|
|
|
@ -42,18 +42,20 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if (!$document->isLocked()) {
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
} else {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("document_is_not_locked"));
|
||||
}
|
||||
|
||||
$lockingUser = $document->getLockingUser();
|
||||
|
||||
if (($lockingUser->getID() == $user->getID()) || ($document->getAccessMode($user) == M_ALL)) {
|
||||
if (!$document->setLocked(false)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,14 +48,6 @@ if($settings->_quota > 0) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("no_update_cause_locked"));
|
||||
}
|
||||
else $document->setLocked(false);
|
||||
}
|
||||
|
||||
if(isset($_POST["comment"]))
|
||||
$comment = $_POST["comment"];
|
||||
else
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -43,9 +44,13 @@ $folder = $document->getFolder();
|
|||
$allUsers = $dms->getAllUsers($settings->_sortUsersInList);
|
||||
$allGroups = $dms->getAllGroups();
|
||||
|
||||
/* 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, 'allusers'=>$allUsers, 'allgroups'=>$allGroups));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"]<1)) {
|
||||
|
@ -41,9 +42,13 @@ if ($document->getAccessMode($user) < M_READ) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
/* 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, 'sortusersinlist'=>$settings->_sortUsersInList));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -33,6 +34,13 @@ if (!is_object($document)) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$version = $document->getContentByVersion($_GET["version"]);
|
||||
if (!is_object($version)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("invalid_version"));
|
||||
|
@ -40,9 +48,13 @@ if (!is_object($version)) {
|
|||
|
||||
$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'=>$version, 'strictformcheck'=>$settings->_strictFormCheck));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -37,12 +38,23 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$folder = $document->getFolder();
|
||||
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all));
|
||||
|
||||
/* 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, 'attrdefs'=>$attrdefs, 'strictformcheck'=>$settings->_strictFormCheck));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -37,6 +38,13 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['targetid']) && $_GET['targetid']) {
|
||||
$target = $dms->getFolder($_GET["targetid"]);
|
||||
if (!is_object($target)) {
|
||||
|
@ -53,9 +61,13 @@ if(isset($_GET['targetid']) && $_GET['targetid']) {
|
|||
|
||||
$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, 'target'=>$target));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -58,9 +59,13 @@ if ($overallStatus["status"] == S_REJECTED || $overallStatus["status"] == S_EXPI
|
|||
|
||||
$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));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -38,11 +39,22 @@ if ($document->getAccessMode($user) < M_ALL) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
$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));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -40,9 +41,13 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
|
||||
$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));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ include("../inc/inc.Utils.php");
|
|||
include("../inc/inc.DBInit.php");
|
||||
include("../inc/inc.Language.php");
|
||||
include("../inc/inc.ClassUI.php");
|
||||
include("../inc/inc.ClassAccessOperation.php");
|
||||
include("../inc/inc.Authentication.php");
|
||||
|
||||
if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_GET["documentid"])<1) {
|
||||
|
@ -38,6 +39,13 @@ if ($document->getAccessMode($user) < M_READWRITE) {
|
|||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied"));
|
||||
}
|
||||
|
||||
if($document->isLocked()) {
|
||||
$lockingUser = $document->getLockingUser();
|
||||
if (($lockingUser->getID() != $user->getID()) && ($document->getAccessMode($user) != M_ALL)) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("lock_message", array("email" => $lockingUser->getEmail(), "username" => htmlspecialchars($lockingUser->getFullName()))));
|
||||
}
|
||||
}
|
||||
|
||||
if($settings->_quota > 0) {
|
||||
$remain = checkQuota($user);
|
||||
if ($remain < 0) {
|
||||
|
@ -47,9 +55,13 @@ if($settings->_quota > 0) {
|
|||
|
||||
$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, 'strictformcheck'=>$settings->_strictFormCheck, 'enablelargefileupload'=>$settings->_enableLargeFileUpload, 'enableadminrevapp'=>$settings->_enableAdminRevApp, 'enableownerrevapp'=>$settings->_enableOwnerRevApp, 'enableselfrevapp'=>$settings->_enableSelfRevApp, 'dropfolderdir'=>$settings->_dropFolderDir, 'workflowmode'=>$settings->_workflowMode));
|
||||
if($view) {
|
||||
$view->setParam('accessobject', $accessop);
|
||||
$view->show();
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ if (!is_object($document)) {
|
|||
$view->exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id"));
|
||||
}
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
|
||||
|
||||
$folder = $document->getFolder();
|
||||
|
||||
if ($document->getAccessMode($user) < M_READ) {
|
||||
|
@ -60,9 +63,6 @@ if ($document->verifyLastestContentExpriry()){
|
|||
header("Location:../out/out.ViewDocument.php?documentid=".$document->getID());
|
||||
}
|
||||
|
||||
/* Create object for checking access to certain operations */
|
||||
$accessop = new SeedDMS_AccessOperation($document, $user, $settings);
|
||||
|
||||
if($view) {
|
||||
$view->setParam('dms', $dms);
|
||||
$view->setParam('user', $user);
|
||||
|
|
Loading…
Reference in New Issue
Block a user