From: Chad Horohoe Date: Sun, 14 Dec 2008 20:49:19 +0000 (+0000) Subject: (bug 7492) Allow assignment of rights to specific IPs/ranges X-Git-Tag: 1.31.0-rc.0~43964 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=cc401646a7d16161e11254301a2ddc4c7e4e22a4;p=lhc%2Fweb%2Fwiklou.git (bug 7492) Allow assignment of rights to specific IPs/ranges --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c9eb852158..4d2398801d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Autopromote.php b/includes/Autopromote.php index 3a9384e59a..e4df13316c 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -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 ) ); diff --git a/includes/Defines.php b/includes/Defines.php index eb97b36242..e9d8e15073 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -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 );