Commit 92059a21f7b0857a491a607925790d54b67eae33
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
Showing
1 changed file
with
8 additions
and
2 deletions
lib/foldermanagement/folderutil.inc.php
| @@ -279,6 +279,12 @@ class KTFolderUtil { | @@ -279,6 +279,12 @@ class KTFolderUtil { | ||
| 279 | // child documents | 279 | // child documents |
| 280 | $aChildDocs = Document::getList(array('folder_id = ?',array($iFolderId))); | 280 | $aChildDocs = Document::getList(array('folder_id = ?',array($iFolderId))); |
| 281 | foreach ($aChildDocs as $oDoc) { | 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 | if ($bIgnorePermissions || (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDoc) && ($oDoc->getIsCheckedOut() == false)) ) { | 288 | if ($bIgnorePermissions || (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDoc) && ($oDoc->getIsCheckedOut() == false)) ) { |
| 283 | $aDocuments[] = $oDoc; | 289 | $aDocuments[] = $oDoc; |
| 284 | } else { | 290 | } else { |
| @@ -290,7 +296,7 @@ class KTFolderUtil { | @@ -290,7 +296,7 @@ class KTFolderUtil { | ||
| 290 | $aCFIds = Folder::getList(array('parent_id = ?', array($iFolderId)), array('ids' => true)); | 296 | $aCFIds = Folder::getList(array('parent_id = ?', array($iFolderId)), array('ids' => true)); |
| 291 | $aRemainingFolders = kt_array_merge($aRemainingFolders, $aCFIds); | 297 | $aRemainingFolders = kt_array_merge($aRemainingFolders, $aCFIds); |
| 292 | } | 298 | } |
| 293 | - | 299 | + |
| 294 | // FIXME we could subdivide this to provide a per-item display (viz. bulk upload, etc.) | 300 | // FIXME we could subdivide this to provide a per-item display (viz. bulk upload, etc.) |
| 295 | 301 | ||
| 296 | if ((!empty($aFailedDocuments) || (!empty($aFailedFolders)))) { | 302 | if ((!empty($aFailedDocuments) || (!empty($aFailedFolders)))) { |
| @@ -304,7 +310,7 @@ class KTFolderUtil { | @@ -304,7 +310,7 @@ class KTFolderUtil { | ||
| 304 | } | 310 | } |
| 305 | return PEAR::raiseError(_kt('You do not have permission to delete these items. ') . $sFD . $sFF); | 311 | return PEAR::raiseError(_kt('You do not have permission to delete these items. ') . $sFD . $sFF); |
| 306 | } | 312 | } |
| 307 | - | 313 | + |
| 308 | // now we can go ahead. | 314 | // now we can go ahead. |
| 309 | foreach ($aDocuments as $oDocument) { | 315 | foreach ($aDocuments as $oDocument) { |
| 310 | $res = KTDocumentUtil::delete($oDocument, $sReason); | 316 | $res = KTDocumentUtil::delete($oDocument, $sReason); |