[Proposal] Solution for filtering out pages in the XE wiki

Vincent Massol vincent at massol.net
Sun Jul 15 12:04:41 CEST 2007


Hi,

We need a global solution for including/excluding pages in the XE  
wiki. The needs comes from the fact that we shouldn't show internal  
pages to casual xwiki users and we shouldn't show pages that they  
don't have the rights to view. At least the following places need to  
use this feature:
* Navigation panel
* All docs Treeview
* All docs Index
* WebSearch
* WebSearchRss
* WebRss
* Orphaned pages + Panel

I propose the following implementation:

1) Add a new API $xwiki.filterDocuments(List docNamesList, String  
persmissionToCheck). It would be used like this:

for each ($item in $xwiki.filterDocuments($xwiki.searchDocuments 
($sql), "view"))
...

In the XE wiki:

2) Add a XWiki.PageFiltersClass class with 1 property: Includes. This  
property will contain pages to exclude, using HQL like format (one  
entry per line)

3) Add a XWiki.PageFiltersClassSheet to explain what this is about,  
explain how to add/remove entries, etc

4) Add a XWiki.PageFilters document that contains a  
XWiki.PageFiltersClass object and which has velocity code in its wiki  
content to compute the HQL clause corresponding to the exclusions  
specified in its object.

5) Modify the documents listed above to use XWiki.PageFilters as  
follows:

#includeInContext("XWiki.PageFilters")
#if (!$pageFiltersSqlClause)
   #set ($pageFiltersSqlClause = "")
#end

#set ($sql = ".... and $pageFiltersSqlClause ...")
#set ($list = $xwiki.filterDocuments($xwiki.searchDocuments($sql ,  
$nb , 0), "view"))

...

WDYT?

Thanks
-Vincent





More information about the devs mailing list