(bug 7492) Allow assignment of rights to specific IPs/ranges
authorChad Horohoe <demon@users.mediawiki.org>
Sun, 14 Dec 2008 20:49:19 +0000 (20:49 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sun, 14 Dec 2008 20:49:19 +0000 (20:49 +0000)
RELEASE-NOTES
includes/Autopromote.php
includes/Defines.php

index c9eb852..4d23988 100644 (file)
@@ -230,6 +230,8 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 16635) The "view and edit watchlist" page (Special:Watchlist/edit) now
   includes a table of contents
 * File objects returned by wfFindFile() are now cached by default
+* (bug 7492) Rights can now be assigned to specific IP addresses and ranges by
+  using $wgAutopromote (new defines: APCOND_ISIP and APCOND_IPINRANGE)
 
 === Bug fixes in 1.14 ===
 
index 3a9384e..e4df133 100644 (file)
@@ -109,6 +109,10 @@ class Autopromote {
                        case APCOND_INGROUPS:
                                $groups = array_slice( $cond, 1 );
                                return count( array_intersect( $groups, $user->getGroups() ) ) == count( $groups );
+                       case APCOND_ISIP:
+                               return $cond[1] == wfGetIP();
+                       case APCOND_IPINRANGE:
+                               return IP::isInRange( wfGetIP(), $cond[1] );
                        default:
                                $result = null;
                                wfRunHooks( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) );
index eb97b36..e9d8e15 100644 (file)
@@ -224,3 +224,5 @@ define( 'APCOND_EDITCOUNT', 1 );
 define( 'APCOND_AGE', 2 );
 define( 'APCOND_EMAILCONFIRMED', 3 );
 define( 'APCOND_INGROUPS', 4 );
+define( 'APCOND_ISIP', 5 );
+define( 'APCOND_IPINRANGE', 6 );