From 57dc5fa31ab2231e806c5807454e5824d7ee8f2f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 3 Apr 2018 11:27:12 +0200 Subject: [PATCH] do not set the uploader of a document to the owner use the currently logged in user instead --- CHANGELOG | 2 ++ SeedDMS_Core/Core/inc.ClassDMS.php | 9 +++++---- SeedDMS_Core/Core/inc.ClassFolder.php | 5 ++--- SeedDMS_Core/package.xml | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ec567bbe5..7c83aeef8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,8 @@ - add number of documents which need correction to menu - minor 2 factor auth. fixes when initially setting the secret - remove Ń•ome unneeded code from AddDocument which just caused php warnings +- do not set the uploader of new documents to owner if the owner is different from + the uploader - merge changes up to 5.1.6 -------------------------------------------------------------------------------- diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 4ab83c02f..959057ba6 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -439,6 +439,7 @@ class SeedDMS_Core_DMS { $this->enableConverting = false; $this->convertFileTypes = array(); $this->noReadForStatus = array(); + $this->user = null; $this->classnames = array(); $this->classnames['folder'] = 'SeedDMS_Core_Folder'; $this->classnames['document'] = 'SeedDMS_Core_Document'; @@ -620,8 +621,9 @@ class SeedDMS_Core_DMS { /** * Set the logged in user * - * If user authentication was done externally, this function can - * be used to tell the dms who is currently logged in. + * This method tells SeeDMS_Core_DMS the currently logged in user. It must be + * called right after instanciating the class, because some methods in + * SeedDMS_Core_Document() require the currently logged in user. * * @param object $user * @@ -633,8 +635,7 @@ class SeedDMS_Core_DMS { /** * Get the logged in user * - * If user authentication was done externally, this function can - * be used to tell the dms who is currently logged in. + * Returns the currently logged in user, as set by setUser() * * @return SeedDMS_Core_User $user * diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index 0761bc6c5..cc7cfa80a 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -917,9 +917,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { $document = $this->_dms->getDocument($db->getInsertID('tblDocuments')); -// if ($version_comment!="") - $res = $document->addContent($version_comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers, $reqversion, $version_attributes, $workflow, $initstate); -// else $res = $document->addContent($comment, $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers,$reqversion, $version_attributes, $workflow); + $curuser = $this->_dms->getLoggedInUser(); + $res = $document->addContent($version_comment, $curuser ? $curuser : $owner, $tmpFile, $orgFileName, $fileType, $mimeType, $reviewers, $approvers, $reqversion, $version_attributes, $workflow, $initstate); if (is_bool($res) && !$res) { $db->rollbackTransaction(); diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index cd247a9ac..2095ca85e 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,7 +12,7 @@ uwe@steinmann.cx yes - 2018-03-14 + 2018-04-03 6.0.6 @@ -24,6 +24,7 @@ GPL License +SeedDMS_Core_Folder::addContent() uses currently logged in user as uploader instead of owner SeedDMS_Core_DocumentContent::verifyStatus() will not set status to S_RELEASED if currently in S_DRAFT status und no workflow, review, approval, or revision is pending.