On 7/15/07, Vincent Massol <[email protected]> wrote:
Hi,
We need a global solution for including/excluding pages in the XE wiki.
[snip ..]
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")) ...
Could this mechanism be used for other types of queries, too? Would be nice if this filter mechanism could replace access checks like this: #if($xwiki.hasAccessLevel("view", "${context.database}:${item}"))
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"))
Sometimes what you want to exclude varies from place to place. Seems like a way to specify an arbitrary document with a PageFiltersClass object would be a way to solve that issue.. (I assume you meant it, and I just didn't read it that way). Erin -- 'Waste of a good apple' -Samwise Gamgee