From 92059a21f7b0857a491a607925790d54b67eae33 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Wed, 26 Jul 2006 10:27:10 +0000 Subject: [PATCH] KTS-1187: Make it so that immutable documents can't be deleted using mass actions - this commit is for deleting folders containing immutable documents. --- lib/foldermanagement/folderutil.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/foldermanagement/folderutil.inc.php b/lib/foldermanagement/folderutil.inc.php index f82bd5d..4ae74be 100644 --- a/lib/foldermanagement/folderutil.inc.php +++ b/lib/foldermanagement/folderutil.inc.php @@ -279,6 +279,12 @@ class KTFolderUtil { // child documents $aChildDocs = Document::getList(array('folder_id = ?',array($iFolderId))); foreach ($aChildDocs as $oDoc) { + if (!$bIgnorePermissions && $oDoc->getImmutable()) { + if (!KTBrowseUtil::inAdminMode($oUser, $oStartFolder)) { + $aFailedDocuments[] = $oDoc->getName(); + continue; + } + } if ($bIgnorePermissions || (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDoc) && ($oDoc->getIsCheckedOut() == false)) ) { $aDocuments[] = $oDoc; } else { @@ -290,7 +296,7 @@ class KTFolderUtil { $aCFIds = Folder::getList(array('parent_id = ?', array($iFolderId)), array('ids' => true)); $aRemainingFolders = kt_array_merge($aRemainingFolders, $aCFIds); } - + // FIXME we could subdivide this to provide a per-item display (viz. bulk upload, etc.) if ((!empty($aFailedDocuments) || (!empty($aFailedFolders)))) { @@ -304,7 +310,7 @@ class KTFolderUtil { } return PEAR::raiseError(_kt('You do not have permission to delete these items. ') . $sFD . $sFF); } - + // now we can go ahead. foreach ($aDocuments as $oDocument) { $res = KTDocumentUtil::delete($oDocument, $sReason); -- libgit2 0.21.4