Extension:IPexception
From MediaWiki.org
|
Release status: experimental |
|||
|---|---|---|---|
| Implementation | User rights | ||
| Description | give read right to users with the correct IP address | ||
| Author(s) | user:Rinkel | ||
| Last Version | 091023 | ||
| MediaWiki | Is tested on 1.14 and 1.15 | ||
| License | No license specified | ||
| Download | see below | ||
|
|||
|
check usage (experimental) |
|||
Contents |
[edit] Goal
For a closed cooperated wiki a part of the company needs to have right access. This simple extension checks if the IP address is in the array.
[edit] Installation
Copy the code to file in extensions/UsageBulkStats/UsageBulkStats.php and include it in localsettings.php with
# this extension give a range of IP adresses read access to the wiki. # link: http://www.mediawiki.org/wiki/Extension:IPexception $IPexception = array("127.0.0.1","192.168.10.10"); require_once( "$IP/extensions/IPexception/IPexception.php");
$IPexception is the range of ip-addresses you want to give the read-rights
[edit] $fileDownloadPermission
This variable I use for a modified img_auth.php to give the users also read rights in the /image/ folder
[edit] CODE - IPexception.php
<?php /** * IPexception extension - Give a IP read exception on a close Wiki * * * For more info see * http://mediawiki.org/wiki/Extension:IPexception * * @package MediaWiki * @subpackage Extensions * @author Rienk Jan Schurer, www.rienkjanschurer.nl, rjs@gmx.li * @copyright © 2009 Rienk Jan Schurer * @license GNU General Public License 2.0 or later */ if( !defined( 'MEDIAWIKI' ) ) { echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); // die( 1 ); } $wgExtensionCredits['other'][] = array( 'name' => 'IPexception', 'author' => 'Rienk Jan Schurer', 'version' => '091023', 'url' => 'http://mediawiki.org/wiki/Extension:IPexception', 'description' => 'IP exception extension', ); function IPexception($IPexception, $IPexceptionPermission){ // if there is no $ipexception array then return if (!is_array($IPexception) ) return $IPexceptionPermission; // if the ip number is found in the array then return true if (in_array($_SERVER['REMOTE_ADDR'], $IPexception)) { $IPexceptionPermission = true; } return $IPexceptionPermission; } $wgGroupPermissions['*']['read'] = IPexception($IPexception, "0"); $fileDownloadPermission = IPexception($IPexception, "0");