Commit f19e939adb3ebc2fdb3e92184bf16423a29af1c5

Authored by jacquiz
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
presentation/lookAndFeel/knowledgeTree/foldermanagement/addFolderBL.php
... ... @@ -30,12 +30,16 @@
30 30 */
31 31  
32 32 require_once("../../../../config/dmsDefaults.php");
  33 +require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
  34 +
33 35 if (checkSession()) {
34 36 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
35 37  
36 38 $oPatternCustom = & new PatternCustom();
37 39  
38 40 if (isset($fFolderID)) {
  41 + //initialse a folder object
  42 + $oFolder = Folder::get($fFolderID);
39 43 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
40 44 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListBox.inc");
41 45 require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc");
... ... @@ -49,7 +53,8 @@ if (checkSession()) {
49 53 if (!isset($fFolderName)) {
50 54 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
51 55 //we're still browsing
52   - if (Permission::userHasFolderWritePermission($fFolderID)) {
  56 +
  57 + if (Permission::userHasFolderWritePermission($oFolder)) {
53 58 //if the user is allowed to add folders, then display the add button
54 59 $oPatternCustom->setHtml(renderBrowseAddPage($fFolderID));
55 60 } else {
... ... @@ -65,7 +70,7 @@ if (checkSession()) {
65 70 // a document type has been specified
66 71 if (isset($fDocumentTypeID)) {
67 72 //have a folder name to store
68   - if (Permission::userHasFolderWritePermission($fFolderID)) {
  73 + if (Permission::userHasFolderWritePermission($oFolder)) {
69 74 //check for illegal characters in the folder name
70 75  
71 76 // strip slashes from the already EPGCS escaped form input
... ...