From 6d9798753b9b407414a19386fe3ae45ef72b0752 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 18 Jan 2017 20:58:52 +0100 Subject: [PATCH] set default access and owner --- op/op.AddDocument.php | 23 ++++++++++++++++++++++- views/bootstrap/class.AddDocument.php | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/op/op.AddDocument.php b/op/op.AddDocument.php index aaa2685ca..d29b394bb 100644 --- a/op/op.AddDocument.php +++ b/op/op.AddDocument.php @@ -56,6 +56,18 @@ if($settings->_quota > 0) { } } +if($user->isAdmin()) { + $ownerid = (int) $_POST["ownerid"]; + if($ownerid) { + if(!($owner = $dms->getUser($ownerid))) { + UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("error_occured")); + } + } else { + $owner = $user; + } +} else { + $owner = $user; +} $comment = trim($_POST["comment"]); $version_comment = trim($_POST["version_comment"]); if($version_comment == "" && isset($_POST["use_comment"])) @@ -287,7 +299,7 @@ for ($file_num=0;$file_numaddDocument($name, $comment, $expires, $user, $keywords, + $res = $folder->addDocument($name, $comment, $expires, $owner, $keywords, $cats, $userfiletmp, basename($userfilename), $fileType, $userfiletype, $sequence, $reviewers, $approvers, $reqversion, @@ -297,6 +309,15 @@ for ($file_num=0;$file_num $folder->getName())),getMLText("error_occured")); } else { $document = $res[0]; + + /* Set access as specified in settings. */ + if($settings->_defaultAccessDocs) { + if($settings->_defaultAccessDocs > 0 && $settings->_defaultAccessDocs < 4) { + $document->setInheritAccess(0, true); + $document->setDefaultAccess($settings->_defaultAccessDocs, true); + } + } + if(isset($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'])) { foreach($GLOBALS['SEEDDMS_HOOKS']['postAddDocument'] as $hookObj) { if (method_exists($hookObj, 'postAddDocument')) { diff --git a/views/bootstrap/class.AddDocument.php b/views/bootstrap/class.AddDocument.php index c7ecba0ca..ddb1108e8 100644 --- a/views/bootstrap/class.AddDocument.php +++ b/views/bootstrap/class.AddDocument.php @@ -196,6 +196,24 @@ console.log(element); : printSequenceChooser($folder->getDocuments('s')); if($orderby != 's') echo "
".getMLText('order_by_sequence_off'); ?> +isAdmin()) { ?> + + : + + + + + getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_all)); if($attrdefs) {