diff --git a/CHANGELOG b/CHANGELOG index 91cc589a2..3f6678227 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ - move some left over javascript from html code into application.js (Closes #253) - take out last empty line from view/bootstrap/class.Search.php which causes a header to be send to early (Closes: #252, #254) +- regular users with sufficient access rights may remove documents via webdav -------------------------------------------------------------------------------- Changes in version 4.3.25 diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 7e754a476..e4bf8ddbd 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -1280,7 +1280,16 @@ class SeedDMS_Core_DMS { if (!$res) return false; - return $this->getUser($this->db->getInsertID()); + $user = $this->getUser($this->db->getInsertID()); + + /* Check if 'onPostAddUser' callback is set */ + if(isset($this->_dms->callbacks['onPostAddUser'])) { + $callback = $this->_dms->callbacks['onPostUser']; + if(!call_user_func($callback[0], $callback[1], $user)) { + } + } + + return $user; } /* }}} */ /** @@ -1332,7 +1341,16 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - return $this->getGroup($this->db->getInsertID()); + $group = $this->getGroup($this->db->getInsertID()); + + /* Check if 'onPostAddGroup' callback is set */ + if(isset($this->_dms->callbacks['onPostAddGroup'])) { + $callback = $this->_dms->callbacks['onPostAddGroup']; + if(!call_user_func($callback[0], $callback[1], $group)) { + } + } + + return $group; } /* }}} */ function getKeywordCategory($id) { /* {{{ */ @@ -1411,7 +1429,16 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - return $this->getKeywordCategory($this->db->getInsertID()); + $category = $this->getKeywordCategory($this->db->getInsertID()); + + /* Check if 'onPostAddKeywordCategory' callback is set */ + if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) { + $callback = $this->_dms->callbacks['onPostAddKeywordCategory']; + if(!call_user_func($callback[0], $callback[1], $category)) { + } + } + + return $category; } /* }}} */ function getDocumentCategory($id) { /* {{{ */ @@ -1477,7 +1504,16 @@ class SeedDMS_Core_DMS { if (!$this->db->getResult($queryStr)) return false; - return $this->getDocumentCategory($this->db->getInsertID()); + $category = $this->getDocumentCategory($this->db->getInsertID()); + + /* Check if 'onPostAddDocumentCategory' callback is set */ + if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) { + $callback = $this->_dms->callbacks['onPostAddDocumentCategory']; + if(!call_user_func($callback[0], $callback[1], $category)) { + } + } + + return $category; } /* }}} */ /** diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index 221bee1a8..d29413c2f 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -1828,7 +1828,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */ $db->startTransaction(); - // FIXME: call a new function removeContent instead + // remove content of document foreach ($this->_content as $version) { if (!$this->removeContent($version)) { $db->rollbackTransaction(); diff --git a/SeedDMS_Core/Core/inc.ClassFolder.php b/SeedDMS_Core/Core/inc.ClassFolder.php index 59c81f8ff..5dd984353 100644 --- a/SeedDMS_Core/Core/inc.ClassFolder.php +++ b/SeedDMS_Core/Core/inc.ClassFolder.php @@ -531,6 +531,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { } $db->commitTransaction(); + + /* Check if 'onPostAddSubFolder' callback is set */ + if(isset($this->_dms->callbacks['onPostAddSubFolder'])) { + $callback = $this->_dms->callbacks['onPostAddSubFolder']; + if(!call_user_func($callback[0], $callback[1], $newFolder)) { + } + } + return $newFolder; } /* }}} */ @@ -841,6 +849,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { } $db->commitTransaction(); + + /* Check if 'onPostAddDocument' callback is set */ + if(isset($this->_dms->callbacks['onPostAddDocument'])) { + $callback = $this->_dms->callbacks['onPostAddDocument']; + if(!call_user_func($callback[0], $callback[1], $document)) { + } + } + return array($document, $res); } /* }}} */ @@ -856,6 +872,14 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { protected function removeFromDatabase() { /* {{{ */ $db = $this->_dms->getDB(); + /* Check if 'onPreRemoveFolder' callback is set */ + if(isset($this->_dms->callbacks['onPreRemoveFolder'])) { + $callback = $this->_dms->callbacks['onPreRemoveFolder']; + if(!call_user_func($callback[0], $callback[1], $this)) { + return false; + } + } + $db->startTransaction(); // unset homefolder as it will no longer exist $queryStr = "UPDATE tblUsers SET homefolder=NULL WHERE homefolder = " . $this->_id; @@ -863,6 +887,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { $db->rollbackTransaction(); return false; } + // Remove database entries $queryStr = "DELETE FROM tblFolders WHERE id = " . $this->_id; if (!$db->getResult($queryStr)) { @@ -887,6 +912,13 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object { } $db->commitTransaction(); + /* Check if 'onPostRemoveFolder' callback is set */ + if(isset($this->_dms->callbacks['onPostRemoveFolder'])) { + $callback = $this->_dms->callbacks['onPostRemoveFolder']; + if(!call_user_func($callback[0], $callback[1], $this->_id)) { + } + } + return true; } /* }}} */ diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index 6ab4ab9c2..2408ef99d 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -12,11 +12,11 @@ uwe@steinmann.cx yes - 2016-03-09 - + 2016-04-04 + - 5.0.2 - 5.0.2 + 5.0.3 + 5.0.3 stable @@ -24,10 +24,7 @@ GPL License -- all changes from 4.3.25 merged -- rename SeedDMS_Core_Group::getNotificationsByGroup() to getNotifications() -- use __construct() for all constructors -- fix setting multi value attributes for versions +- all changes from 4.3.26 merged @@ -1010,6 +1007,24 @@ SeedDMS_Core_DMS::getNotificationsByUser() are deprecated - SeedDMS_Core_User::getDocumentsLocked() sets locking user propperly + + 2016-03-08 + + + 4.3.25 + 4.3.25 + + + stable + stable + + GPL License + +- rename SeedDMS_Core_Group::getNotificationsByGroup() to getNotifications() +- use __construct() for all constructors +- fix setting multi value attributes for versions + + 2016-01-22 diff --git a/op/op.Login.php b/op/op.Login.php index f3c3d51ba..2eae79ce8 100644 --- a/op/op.Login.php +++ b/op/op.Login.php @@ -303,7 +303,7 @@ if (isset($_COOKIE["mydms_session"])) { setcookie("mydms_session", $id, $lifetime, $settings->_httpRoot, null, null, !$settings->_enableLargeFileUpload); } -// TODO: by the PHP manual: The superglobals $_GET and $_REQUEST are already decoded. +// TODO: by the PHP manual: The superglobals $_GET and $_REQUEST are already decoded. // Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results. if (isset($_POST["referuri"]) && strlen($_POST["referuri"])>0) { diff --git a/webdav/webdav.php b/webdav/webdav.php index a08dc107d..487710d94 100644 --- a/webdav/webdav.php +++ b/webdav/webdav.php @@ -668,9 +668,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server } else { // check if user is admin // only admins may delete documents + /* There is not reason to allow only admins to remove a document if(!$this->user->isAdmin()) { return "403 Forbidden"; } + */ if(!$obj->remove()) { return "409 Conflict";