Commit 92059a21f7b0857a491a607925790d54b67eae33

Authored by Neil Blakey-Milner
1 parent d1baf2a7

KTS-1187: Make it so that immutable documents can't be deleted using

mass actions - this commit is for deleting folders containing immutable
documents.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5752 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/foldermanagement/folderutil.inc.php
... ... @@ -279,6 +279,12 @@ class KTFolderUtil {
279 279 // child documents
280 280 $aChildDocs = Document::getList(array('folder_id = ?',array($iFolderId)));
281 281 foreach ($aChildDocs as $oDoc) {
  282 + if (!$bIgnorePermissions && $oDoc->getImmutable()) {
  283 + if (!KTBrowseUtil::inAdminMode($oUser, $oStartFolder)) {
  284 + $aFailedDocuments[] = $oDoc->getName();
  285 + continue;
  286 + }
  287 + }
282 288 if ($bIgnorePermissions || (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDoc) && ($oDoc->getIsCheckedOut() == false)) ) {
283 289 $aDocuments[] = $oDoc;
284 290 } else {
... ... @@ -290,7 +296,7 @@ class KTFolderUtil {
290 296 $aCFIds = Folder::getList(array('parent_id = ?', array($iFolderId)), array('ids' => true));
291 297 $aRemainingFolders = kt_array_merge($aRemainingFolders, $aCFIds);
292 298 }
293   -
  299 +
294 300 // FIXME we could subdivide this to provide a per-item display (viz. bulk upload, etc.)
295 301  
296 302 if ((!empty($aFailedDocuments) || (!empty($aFailedFolders)))) {
... ... @@ -304,7 +310,7 @@ class KTFolderUtil {
304 310 }
305 311 return PEAR::raiseError(_kt('You do not have permission to delete these items. ') . $sFD . $sFF);
306 312 }
307   -
  313 +
308 314 // now we can go ahead.
309 315 foreach ($aDocuments as $oDocument) {
310 316 $res = KTDocumentUtil::delete($oDocument, $sReason);
... ...