Commit a78a6eae1fa73fd02b71b81d558ab16b3404adae
1 parent
baa47981
Type: functionality change
Description: Pass the document object around to the permission checks instead of the documentID to avoid redundant db checks git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2876 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
4 additions
and
4 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
| @@ -82,14 +82,14 @@ if (checkSession()) { | @@ -82,14 +82,14 @@ if (checkSession()) { | ||
| 82 | $oPatternCustom = & new PatternCustom(); | 82 | $oPatternCustom = & new PatternCustom(); |
| 83 | if (isset($fDocumentID)) { | 83 | if (isset($fDocumentID)) { |
| 84 | $oDocument = & Document::get($fDocumentID); | 84 | $oDocument = & Document::get($fDocumentID); |
| 85 | - if (isset($fCollaborationEdit) && Permission::userHasDocumentWritePermission($fDocumentID)) { | 85 | + if (isset($fCollaborationEdit) && Permission::userHasDocumentWritePermission($oDocument)) { |
| 86 | //return value from collaborationBL.php. User attempted to edit | 86 | //return value from collaborationBL.php. User attempted to edit |
| 87 | //a step in the document collaboration process that is currently being | 87 | //a step in the document collaboration process that is currently being |
| 88 | //executed | 88 | //executed |
| 89 | $sStatusMessage = "You cannot edit a document collaboration step that is completed or currently underway"; | 89 | $sStatusMessage = "You cannot edit a document collaboration step that is completed or currently underway"; |
| 90 | $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | 90 | $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); |
| 91 | $main->setDHTMLScrolling(false); | 91 | $main->setDHTMLScrolling(false); |
| 92 | - } else if (isset($fBeginCollaboration) && Permission::userHasDocumentWritePermission($fDocumentID)) { | 92 | + } else if (isset($fBeginCollaboration) && Permission::userHasDocumentWritePermission($oDocument)) { |
| 93 | //begin the collaboration process | 93 | //begin the collaboration process |
| 94 | //first ensure that all steps in the collaboration process are assigned | 94 | //first ensure that all steps in the collaboration process are assigned |
| 95 | $aFolderCollaboration = FolderCollaboration::getList("WHERE folder_id = " . $oDocument->getFolderID()); | 95 | $aFolderCollaboration = FolderCollaboration::getList("WHERE folder_id = " . $oDocument->getFolderID()); |
| @@ -222,7 +222,7 @@ if (checkSession()) { | @@ -222,7 +222,7 @@ if (checkSession()) { | ||
| 222 | } | 222 | } |
| 223 | $main->setDHTMLScrolling(false); | 223 | $main->setDHTMLScrolling(false); |
| 224 | 224 | ||
| 225 | - } else if (Permission::userHasDocumentWritePermission($fDocumentID) || Permission::userHasDocumentReadPermission($fDocumentID)) { | 225 | + } else if (Permission::userHasDocumentWritePermission($oDocument) || Permission::userHasDocumentReadPermission($fDocumentID)) { |
| 226 | 226 | ||
| 227 | // check subscription flag | 227 | // check subscription flag |
| 228 | // ?? | 228 | // ?? |
| @@ -236,7 +236,7 @@ if (checkSession()) { | @@ -236,7 +236,7 @@ if (checkSession()) { | ||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | if ($oDocument->isLive()) { | 238 | if ($oDocument->isLive()) { |
| 239 | - if (Permission::userHasDocumentWritePermission($fDocumentID)) { | 239 | + if (Permission::userHasDocumentWritePermission($oDocument)) { |
| 240 | $oPatternCustom->setHtml(getPage($oDocument, true)); | 240 | $oPatternCustom->setHtml(getPage($oDocument, true)); |
| 241 | } else if (Permission::userHasDocumentReadPermission($fDocumentID)) { | 241 | } else if (Permission::userHasDocumentReadPermission($fDocumentID)) { |
| 242 | $oPatternCustom->setHtml(getPage($oDocument, false)); | 242 | $oPatternCustom->setHtml(getPage($oDocument, false)); |