From 526decbf842c701f6775d1c1d2a3cc7a70cdfe93 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Tue, 7 Oct 2008 15:56:56 +0000 Subject: [PATCH] Merged in... --- lib/foldermanagement/folderutil.inc.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+), 0 deletions(-) diff --git a/lib/foldermanagement/folderutil.inc.php b/lib/foldermanagement/folderutil.inc.php index f31fb9a..d6d0350 100644 --- a/lib/foldermanagement/folderutil.inc.php +++ b/lib/foldermanagement/folderutil.inc.php @@ -200,6 +200,9 @@ class KTFolderUtil { return $res; } + // Regenerate the folder object - ensure the updated information is taken into account + $oFolder = Folder::get($oFolder->getID()); + $res = $oStorage->moveFolder($oFolder, $oNewParentFolder); if (PEAR::isError($res)) { return $res; @@ -450,6 +453,19 @@ class KTFolderUtil { return PEAR::raiseError(_kt('You are not allowed to create folders in the destination.')); } + // Check if the source folder inherits its permissions + // Get source PO id and its parent PO id + $iSrcPoId = $oSrcFolder->getPermissionObjectID(); + $oSrcParent = Folder::get($oSrcFolder->getParentID()); + $iSrcParentPoId = $srcParent->getPermissionObjectID(); + + // If the folder defines its own permissions then we leave it + // If the source folder inherits permissions we must change it to inherit from the new parent folder + $bInheritPermissions = false; + if($iSrcPoId == $iSrcParentPoId){ + $bInheritPermissions = true; + } + $aFolderIds = array(); // of oFolder $aDocuments = array(); // of oDocument $aFailedDocuments = array(); // of String @@ -592,6 +608,14 @@ class KTFolderUtil { } } + // If the folder inherits its permissions then we set it to inherit from the new parent folder and update permissions + if($bInheritPermissions){ + $aOptions = array( + 'evenifnotowner' => true, // Inherit from parent folder, even though not permission owner + ); + KTPermissionUtil::inheritPermissionObject($oNewBaseFolder, $aOptions); + } + // and store DBUtil::commit(); -- libgit2 0.21.4