[pmwiki-users] Excluding anything but Main group from searches

Patrick R. Michaud pmichaud at pobox.com
Thu May 10 08:48:34 CDT 2007


On Thu, May 10, 2007 at 02:24:19PM +0100, Hans wrote:
> Thursday, May 10, 2007, 1:32:57 PM, Patrick R. Michaud wrote:
> 
> > Isn't it just...?
> 
> >     $SearchPatterns['default']['main'] = '/^Main\./';
> >     $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!';
> 
> Hmm, yes, thank you! I chnaged it to:
> 
> if(CondAuth($pagename,'read')) {
>     $SearchPatterns['default']['main'] = '/^Main\./';
>     $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!';
>     $SearchPatterns['default']['pagetopmenu'] = '!^Main\.PageTopMenu$!';
>     $SearchPatterns['default']['sidebar'] = '!^Main\.SideBar$!';
> }    
> 
> if(CondAuth($pagename,'edit')) {
>     $SearchPatterns['default']['main'] = '/^.*\./';
>     $SearchPatterns['default']['sandbox'] = '';
>     $SearchPatterns['default']['pagetopmenu'] = '';
>     $SearchPatterns['default']['sidebar'] = '';    
> }
> 
> in order to get full search results if logged in as editor.

I would've done the above as:

  if (!CondAuth($pagename, 'edit')) {
    $SearchPatterns['default']['main'] = '/^Main\./';
    $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!';
    $SearchPatterns['default']['pagetopmenu'] = '!^Main\.PageTopMenu$!';
    $SearchPatterns['default']['sidebar'] = '!^Main\.SideBar$!';
  }    

In other words, limit the search only if the person doesn't have
edit permissions.

> Before I tried to set (:searchbox group=Main name=-WikiSandbox ...:),
> but it needs to be done in Site.Search as well, for subsequent
> searches.

It can be done in Site.Search only -- it doesn't have to go in
the searchbox.

> In any case there are changes to be made in various places, and it
> would be good to document this. Maybe this needs a new Cookbook page?
> WikiInDisguise?

Sure, or perhaps just 'SingleGroupWiki' .

Pm



More information about the pmwiki-users mailing list