From 12681aca9d1f5d3a31e2207a8ba2f59a22ff2389 Mon Sep 17 00:00:00 2001 From: Megan Watson Date: Wed, 1 Oct 2008 10:38:33 +0000 Subject: [PATCH] KTS-3739 "Although 'Action Restrictions' for 'Delete' and 'Download' are set the user can still Delete and Download the document via the bulk actions when in folder view." Fixed. Added a check on the workflow. --- lib/documentmanagement/documentutil.inc.php | 4 ++++ plugins/ktcore/KTBulkActions.php | 14 ++++++++++++++ plugins/ktstandard/KTBulkExportPlugin.php | 5 +++++ 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/lib/documentmanagement/documentutil.inc.php b/lib/documentmanagement/documentutil.inc.php index d7a0a76..876c184 100644 --- a/lib/documentmanagement/documentutil.inc.php +++ b/lib/documentmanagement/documentutil.inc.php @@ -908,6 +908,10 @@ $sourceDocument->getName(), return PEAR::raiseError(sprintf(_kt('The document is checked out and cannot be deleted: %s'), $oDocument->getName())); } + if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.delete')){ + return PEAR::raiseError(_kt('Document cannot be deleted as it is restricted by the workflow.')); + } + // IF we're deleted ... if ($oDocument->getStatusID() == DELETED) { return true; diff --git a/plugins/ktcore/KTBulkActions.php b/plugins/ktcore/KTBulkActions.php index 2e559d7..ff3ed56 100644 --- a/plugins/ktcore/KTBulkActions.php +++ b/plugins/ktcore/KTBulkActions.php @@ -57,6 +57,9 @@ class KTBulkDeleteAction extends KTBulkAction { { return PEAR::raiseError(_kt('Document cannot be deleted as it is immutable')); } + if(!KTWorkflowUtil::actionEnabledForDocument($oEntity, 'ktcore.actions.document.delete')){ + return PEAR::raiseError(_kt('Document cannot be deleted as it is restricted by the workflow.')); + } } return parent::check_entity($oEntity); } @@ -705,6 +708,11 @@ class KTBrowseBulkExportAction extends KTBulkAction { return PEAR::raiseError(_kt('You do not have the required permissions')); } } + if(is_a($oEntity, 'Document')){ + if(!KTWorkflowUtil::actionEnabledForDocument($oEntity, 'ktcore.actions.document.view')){ + return PEAR::raiseError(_kt('Document cannot be exported as it is restricted by the workflow.')); + } + } return parent::check_entity($oEntity); } @@ -844,6 +852,12 @@ class KTBrowseBulkExportAction extends KTBulkAction { $oDocument->switchToLinkedCore(); } if(Permission::userHasDocumentReadPermission($oDocument)){ + + if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.view')){ + $this->addErrorMessage($oDocument->getName().': '._kt('Document cannot be exported as it is restricted by the workflow.')); + continue; + } + $sDocFolderId = $oDocument->getFolderID(); $oFolder = isset($aFolderObjects[$sDocFolderId]) ? $aFolderObjects[$sDocFolderId] : Folder::get($sDocFolderId); diff --git a/plugins/ktstandard/KTBulkExportPlugin.php b/plugins/ktstandard/KTBulkExportPlugin.php index edad3a3..dbd7ca5 100644 --- a/plugins/ktstandard/KTBulkExportPlugin.php +++ b/plugins/ktstandard/KTBulkExportPlugin.php @@ -140,6 +140,11 @@ class KTBulkExportAction extends KTFolderAction { $oDocument = Document::get($iId); $sFolderId = $oDocument->getFolderID(); + if(!KTWorkflowUtil::actionEnabledForDocument($oDocument, 'ktcore.actions.document.view')){ + $this->addErrorMessage($oDocument->getName().': '._kt('Document cannot be exported as it is restricted by the workflow.')); + continue; + } + $oFolder = isset($aFolderObjects[$sFolderId]) ? $aFolderObjects[$sFolderId] : Folder::get($sFolderId); if ($bNoisy) { -- libgit2 0.21.4