[pmwiki-users] AuthUser and IP-based authorisation

John Rankin john.rankin at affinity.co.nz
Tue Oct 14 17:35:03 CDT 2008


On Wednesday, 15 October 2008 12:28 AM, Eemeli Aro <eemeli at gmail.com> wrote:
>2008/10/14 John Rankin <john.rankin at affinity.co.nz>:
>> What would be involved in extending AuthUser to grant access
>> based on IP address?
>>
>Hmmm. Here's something I just thought of as a possible answer, haven't
>tested this so can't verify whether it'll work:
>
>Add this to your config file:
>
>$AuthUserFunctions['ip'] = 'AuthUserIP';
>function AuthUserIP($pagename, $id, $pw, $pwlist) {
>  $i = '';
>  foreach ( (array)$pwlist as $d ) {
>    if ($d==$id) { $i = $d; continue; }
>    if ( $i && ( $_SERVER['REMOTE_ADDR'] == $d ) ) return true;
>  }
>  return false;
>}
>
>Then, use the following in you SiteAdmin.AuthUser file:
>
>ip: username ip-address
>
>...
>
>Then, try accessing the site from the defined IP address & log in with
>the user name, leaving the password field blank. If it works, you
>ought to be able to use PublishPDF by adding "&authid=username" to the
>end of a request coming from that server.
>
>eemeli
>
This looks like a very promising solution. Thank you.

I can tell the PublishPDF plug-in to add authid=username (with default
set to authid=wikibook) by testing $EnableAuthUser. This will pass the
username from the wiki to the wikibook server, which will in turn use 
it to query the selected page(s).

Eemeli, if you don't mind, I'd like to turn this into a wikipublisher
recipe.

-- 
JR
--
John Rankin

       \_      
        \)   
         \,\__/7
         /    /
        (   c'
         \  / 
     /,  /_/  
    |  & *   Wellington
    )  /    
   /  /,    
  /  (    
 |   /      
 \__/       
   V        






More information about the pmwiki-users mailing list