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 | 82 | $oPatternCustom = & new PatternCustom(); |
| 83 | 83 | if (isset($fDocumentID)) { |
| 84 | 84 | $oDocument = & Document::get($fDocumentID); |
| 85 | - if (isset($fCollaborationEdit) && Permission::userHasDocumentWritePermission($fDocumentID)) { | |
| 85 | + if (isset($fCollaborationEdit) && Permission::userHasDocumentWritePermission($oDocument)) { | |
| 86 | 86 | //return value from collaborationBL.php. User attempted to edit |
| 87 | 87 | //a step in the document collaboration process that is currently being |
| 88 | 88 | //executed |
| 89 | 89 | $sStatusMessage = "You cannot edit a document collaboration step that is completed or currently underway"; |
| 90 | 90 | $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); |
| 91 | 91 | $main->setDHTMLScrolling(false); |
| 92 | - } else if (isset($fBeginCollaboration) && Permission::userHasDocumentWritePermission($fDocumentID)) { | |
| 92 | + } else if (isset($fBeginCollaboration) && Permission::userHasDocumentWritePermission($oDocument)) { | |
| 93 | 93 | //begin the collaboration process |
| 94 | 94 | //first ensure that all steps in the collaboration process are assigned |
| 95 | 95 | $aFolderCollaboration = FolderCollaboration::getList("WHERE folder_id = " . $oDocument->getFolderID()); |
| ... | ... | @@ -222,7 +222,7 @@ if (checkSession()) { |
| 222 | 222 | } |
| 223 | 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 | 227 | // check subscription flag |
| 228 | 228 | // ?? |
| ... | ... | @@ -236,7 +236,7 @@ if (checkSession()) { |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if ($oDocument->isLive()) { |
| 239 | - if (Permission::userHasDocumentWritePermission($fDocumentID)) { | |
| 239 | + if (Permission::userHasDocumentWritePermission($oDocument)) { | |
| 240 | 240 | $oPatternCustom->setHtml(getPage($oDocument, true)); |
| 241 | 241 | } else if (Permission::userHasDocumentReadPermission($fDocumentID)) { |
| 242 | 242 | $oPatternCustom->setHtml(getPage($oDocument, false)); | ... | ... |