Commit f19e939adb3ebc2fdb3e92184bf16423a29af1c5
1 parent
64d114c4
Type: functionality change
Description: Passing through folder object instead of folder id to permissions checks to avoid redundant DB accesses to intsantiate db model objects git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2878 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
7 additions
and
2 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/addFolderBL.php
| @@ -30,12 +30,16 @@ | @@ -30,12 +30,16 @@ | ||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | require_once("../../../../config/dmsDefaults.php"); | 32 | require_once("../../../../config/dmsDefaults.php"); |
| 33 | +require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | ||
| 34 | + | ||
| 33 | if (checkSession()) { | 35 | if (checkSession()) { |
| 34 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); | 36 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 35 | 37 | ||
| 36 | $oPatternCustom = & new PatternCustom(); | 38 | $oPatternCustom = & new PatternCustom(); |
| 37 | 39 | ||
| 38 | if (isset($fFolderID)) { | 40 | if (isset($fFolderID)) { |
| 41 | + //initialse a folder object | ||
| 42 | + $oFolder = Folder::get($fFolderID); | ||
| 39 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | 43 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); |
| 40 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); | 44 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc"); |
| 41 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 45 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| @@ -49,7 +53,8 @@ if (checkSession()) { | @@ -49,7 +53,8 @@ if (checkSession()) { | ||
| 49 | if (!isset($fFolderName)) { | 53 | if (!isset($fFolderName)) { |
| 50 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 54 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 51 | //we're still browsing | 55 | //we're still browsing |
| 52 | - if (Permission::userHasFolderWritePermission($fFolderID)) { | 56 | + |
| 57 | + if (Permission::userHasFolderWritePermission($oFolder)) { | ||
| 53 | //if the user is allowed to add folders, then display the add button | 58 | //if the user is allowed to add folders, then display the add button |
| 54 | $oPatternCustom->setHtml(renderBrowseAddPage($fFolderID)); | 59 | $oPatternCustom->setHtml(renderBrowseAddPage($fFolderID)); |
| 55 | } else { | 60 | } else { |
| @@ -65,7 +70,7 @@ if (checkSession()) { | @@ -65,7 +70,7 @@ if (checkSession()) { | ||
| 65 | // a document type has been specified | 70 | // a document type has been specified |
| 66 | if (isset($fDocumentTypeID)) { | 71 | if (isset($fDocumentTypeID)) { |
| 67 | //have a folder name to store | 72 | //have a folder name to store |
| 68 | - if (Permission::userHasFolderWritePermission($fFolderID)) { | 73 | + if (Permission::userHasFolderWritePermission($oFolder)) { |
| 69 | //check for illegal characters in the folder name | 74 | //check for illegal characters in the folder name |
| 70 | 75 | ||
| 71 | // strip slashes from the already EPGCS escaped form input | 76 | // strip slashes from the already EPGCS escaped form input |