change behaviour of mayEditComment and mayEditAttributes

This commit is contained in:
Uwe Steinmann 2021-06-25 08:54:05 +02:00
parent d871bd6e62
commit ff9385bf1e
2 changed files with 12 additions and 6 deletions

View File

@ -21,6 +21,9 @@
- append referuri to base url to prevent redirects to arbitraty sites in op.Login.php
- theme can be set in user manager
- fields in configuration can be omitted from display and saving
- comment of document version may not be modified when document has expired
- attributes of document version may be edited if enableVersionModification is true
even if the document has been released, obsoleted or has been expired
--------------------------------------------------------------------------------
Changes in version 5.1.22

View File

@ -192,12 +192,14 @@ class SeedDMS_AccessOperation {
*
* This check can only be done for documents. Setting the documents
* comment date is only allowed if version modification is turned on in
* the settings and the document has not been obsoleted.
* the settings and the document has not been obsoleted or expired.
* The admin may set the comment even if is
* disallowed in the settings.
*/
function mayEditComment() { /* {{{ */
if($this->obj->isType('document')) {
if($this->obj->getAccessMode($this->user) < M_READWRITE)
return false;
if($this->obj->isLocked()) {
$lockingUser = $this->obj->getLockingUser();
if (($lockingUser->getID() != $this->user->getID()) && ($this->obj->getAccessMode($this->user) != M_ALL)) {
@ -206,7 +208,7 @@ class SeedDMS_AccessOperation {
}
$latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus();
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) {
if (($this->settings->_enableVersionModification || $this->user->isAdmin()) && !in_array($status["status"], array(S_OBSOLETE, S_EXPIRED))) {
return true;
}
}
@ -218,9 +220,8 @@ class SeedDMS_AccessOperation {
*
* Setting the object attributes
* is only allowed if version modification is turned on in
* the settings and the document has not been obsoleted.
* The admin may set the comment even if is
* disallowed in the settings.
* the settings or the document is still in an approval/review
* or intial workflow step.
*/
function mayEditAttributes() { /* {{{ */
if($this->obj->isType('document')) {
@ -228,7 +229,9 @@ class SeedDMS_AccessOperation {
$status = $latestContent->getStatus();
$workflow = $latestContent->getWorkflow();
$workflowstate = $latestContent->getWorkflowState();
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) >= M_READWRITE)) || $this->user->isAdmin()) && (in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP)) || ($workflow && $workflowstate && $workflow->getInitState()->getID() == $workflowstate->getID()))) {
if($this->obj->getAccessMode($this->user) < M_READWRITE)
return false;
if ($this->settings->_enableVersionModification || in_array($status["status"], array(S_DRAFT_REV, S_DRAFT_APP)) || ($workflow && $workflowstate && $workflow->getInitState()->getID() == $workflowstate->getID())) {
return true;
}
}