Author: peter
Date: Thu Sep 17 16:28:38 2009
New Revision: 3390

Log:
don't return informationobjects with 'draft' publication status in search 
results if the user doesn't have 'view draft' permission. Still need 
'QubitAcl::check(QubitInformationObject::getRoot(), 
QubitAclAction::VIEW_DRAFT_ID)' to work correctly (right now returns true, even 
for anonymous users who have not been assigned the 'view draft' permission

Modified:
   trunk/apps/qubit/modules/informationobject/actions/listAction.class.php
   trunk/apps/qubit/modules/search/actions/searchAction.class.php

Modified: 
trunk/apps/qubit/modules/informationobject/actions/listAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/listAction.class.php     
Thu Sep 17 16:26:23 2009        (r3389)
+++ trunk/apps/qubit/modules/informationobject/actions/listAction.class.php     
Thu Sep 17 16:28:38 2009        (r3390)
@@ -72,13 +72,20 @@
     $request->setAttribute('informationObject', $this->informationObject);
 
     $search = new QubitSearch;
-    $query = new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term($request->id, 'parentId'));
+
+    $query = new Zend_Search_Lucene_Search_Query_Boolean;
+    $query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term($request->id, 'parentId')));
 
     if (isset($request->query))
     {
       $query = $request->query;
     }
 
+    if (!QubitAcl::check(QubitInformationObject::getRoot(), 
QubitAclAction::VIEW_DRAFT_ID))
+    {
+      $query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term(QubitTerm::PUBLICATION_STATUS_DRAFT_ID, 
'publicationStatusId')), false);
+    }
+
     $this->pager = new 
QubitSearchPager($search->getEngine()->getIndex()->find($query), 
$request->page);
 
     $ids = array();

Modified: trunk/apps/qubit/modules/search/actions/searchAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/search/actions/searchAction.class.php      Thu Sep 
17 16:26:23 2009        (r3389)
+++ trunk/apps/qubit/modules/search/actions/searchAction.class.php      Thu Sep 
17 16:28:38 2009        (r3390)
@@ -33,6 +33,12 @@
 
     $query = new Zend_Search_Lucene_Search_Query_Boolean;
     $query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term($culture, 'culture')), true);
+
+    if (!QubitAcl::check(QubitInformationObject::getRoot(), 
QubitAclAction::VIEW_DRAFT_ID))
+    {
+      $query->addSubquery(new Zend_Search_Lucene_Search_Query_Term(new 
Zend_Search_Lucene_Index_Term(QubitTerm::PUBLICATION_STATUS_DRAFT_ID, 
'publicationStatusId')), false);
+    }
+
     
$query->addSubquery(Zend_Search_Lucene_Search_QueryParser::parse($request->query,
 'UTF-8'), true);
 
     $this->pager = new 
QubitSearchPager($search->getEngine()->getIndex()->find($query), 
$request->page);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to