diff --git a/lib/plugins/plugin.inc.php b/lib/plugins/plugin.inc.php index 859ac82..8e6840e 100644 --- a/lib/plugins/plugin.inc.php +++ b/lib/plugins/plugin.inc.php @@ -364,7 +364,7 @@ class KTPlugin { } function stripKtDir($sFilename) { - if (strpos($sFilename, KT_DIR) === 0) { + if (strpos($sFilename, KT_DIR) === 0 ||strpos($sFilename, realpath(KT_DIR)) === 0) { return substr($sFilename, strlen(KT_DIR) + 1); } return $sFilename; diff --git a/plugins/ktcore/KTPermissions.php b/plugins/ktcore/KTPermissions.php index 57627a0..b5d5c4d 100644 --- a/plugins/ktcore/KTPermissions.php +++ b/plugins/ktcore/KTPermissions.php @@ -432,6 +432,35 @@ class KTRoleAllocationPlugin extends KTFolderAction { 'redirect_to' => array('main', sprintf('fFolderId=%d', $this->oFolder->getId())), ); $this->oValidator->notErrorFalse($oTransaction, $aOptions); + + // inherit parent permissions + $oParentAllocation = RoleAllocation::getAllocationsForFolderAndRole($this->oFolder->getParentID(), $role_id); + if (!is_null($oParentAllocation) && !PEAR::isError($oParentAllocation)) + { + $oPD = $oParentAllocation->getPermissionDescriptor(); + + $aAllowed = $oPD->getAllowed(); + $userids=$aAllowed['user']; + $groupids=$aAllowed['group']; + + // now lets update for the new allocation + $oPD = $oRoleAllocation->getPermissionDescriptor(); + + $aAllowed = $oPD->getAllowed(); + + $aAllowed['user'] = $userids; + $aAllowed['group'] = $groupids; + + $oRoleAllocation->setAllowed($aAllowed); + $res = $oRoleAllocation->update(); + + if (PEAR::isError($res) || ($res == false)) + { + $this->errorRedirectToMain(_kt('Failed to create the role allocation.') . print_r($res, true), sprintf('fFolderId=%d', $this->oFolder->getId())); + } + } + + // regenerate permissions $this->renegeratePermissionsForRole($oRoleAllocation->getRoleId()); diff --git a/setup/upgrade.php b/setup/upgrade.php index 2fde263..662e740 100644 --- a/setup/upgrade.php +++ b/setup/upgrade.php @@ -434,7 +434,7 @@ function resolveTempDir() { $dir='c:/kt-db-backup'; } - + $oKTConfig =& KTConfig::getSingleton(); $dir = $oKTConfig->get('backups/backupDirectory',$dir); if (!is_dir($dir))