[dokuwiki] Re: Restrict registration to certain IP range

  • From: Myron Turner <turnermm02@xxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 03 Oct 2007 21:03:08 -0500

Ben Coburn wrote:

On Oct 3, 2007, at 09:28, Martin Grandrath wrote:

Hello,

I plan to provide a wiki system for my university.  My idea is to make
the wiki world-readable but only registered users are allowed to
write, upload, etc.  To ensure that only members of the university can
register I thought about restricting the registration to the IP range
that belongs to the university.



Or, if you have an LDAP server, you could try the LDAP authentication type (and disable registration). This way users would just use their existing usernames and passwords for the wiki.

Regards, Ben Coburn




I wonder if one solution might be to write a small action plugin that checks the IP addresses and then to set:
                                    $INFO['writable'] = false;
For instance:

function register(&$controller) {
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'check_IP');
 }

function check_IP() {
   global $INFO;
  $universityIP = array(addr1,addr2. . . );
  $IP = $_SERVER['REMOTE_ADDR'];
  if(!in_array($IP, $universityIP)) {
             $INFO['writable'] = false;
}
}

I could be wrong, but I think that the TPL_METAHEADER_OUTPUT event is always processed.

Myron

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/


--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: