Adding apihighlimits permission. Users with this permission can request 10 times...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 29 Nov 2007 14:51:58 +0000 (14:51 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 29 Nov 2007 14:51:58 +0000 (14:51 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/api/ApiBase.php
includes/api/ApiMain.php

index b976837..0ec26cf 100644 (file)
@@ -196,7 +196,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   for users with special characters in their names
 * The number of watching users in watchlists was always reported as 1
 * namespaceDupes.php no longer dies when coming across an illegal title
-* Make API check for restrictions in the old format too.
 * (bug 12143) Do not show a link to patrol new pages for non existent pages
 
 == Parser changes in 1.12 ==
@@ -302,6 +301,8 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API
 * (bug 11206) api.php should honor maxlag
 * Added diff generation to prop=revisions
 * Added support for traditional, unified and array diffs to prop=revisions
+* Make prop=info check for restrictions in the old format too.
+* Add apihighlimits permission, default for sysops and bots
 
 === Languages updated in 1.12 ===
 
index b54767b..9c8c726 100644 (file)
@@ -1072,6 +1072,7 @@ $wgGroupPermissions['bot'  ]['autoconfirmed']   = true;
 $wgGroupPermissions['bot'  ]['nominornewtalk']  = true;
 $wgGroupPermissions['bot'  ]['autopatrol']      = true;
 $wgGroupPermissions['bot'  ]['suppressredirect'] = true;
+$wgGroupPermissions['bot'  ]['apihighlimits']   = true;
 
 // Most extra permission abilities go to this group
 $wgGroupPermissions['sysop']['block']           = true;
@@ -1099,6 +1100,7 @@ $wgGroupPermissions['sysop']['ipblock-exempt']    = true;
 $wgGroupPermissions['sysop']['blockemail']      = true;
 $wgGroupPermissions['sysop']['markbotedits']   = true;
 $wgGroupPermissions['sysop']['suppressredirect'] = true;
+$wgGroupPermissions['sysop']['apihighlimits']   = true;
 #$wgGroupPermissions['sysop']['mergehistory']    = true;
 
 // Permission to change users' group assignments
index 6c97a5b..2191a95 100644 (file)
@@ -485,7 +485,7 @@ abstract class ApiBase {
                // Optimization: do not check user's bot status unless really needed -- skips db query
                // assumes $botMax >= $max
                if (!is_null($max) && $value > $max) {
-                       if (!is_null($botMax) && ($this->getMain()->isBot() || $this->getMain()->isSysop())) {
+                       if (!is_null($botMax) && ($this->getMain()->canApiHighLimits())) {
                                if ($value > $botMax) {
                                        $this->dieUsage($this->encodeParamName($paramName) . " may not be over $botMax (set to $value) for bots or sysops", $paramName);
                                }
index 6ce44a6..acf3e50 100644 (file)
@@ -467,11 +467,12 @@ class ApiMain extends ApiBase {
        } 
 
        private $mIsBot = null;
-       
        private $mIsSysop = null;
+       private $mCanApiHighLimits = null;
        
        /**
         * Returns true if the currently logged in user is a bot, false otherwise
+        * OBSOLETE, use canApiHighLimits() instead
         */
        public function isBot() {
                if (!isset ($this->mIsBot)) {
@@ -484,6 +485,7 @@ class ApiMain extends ApiBase {
        /**
         * Similar to isBot(), this method returns true if the logged in user is
         * a sysop, and false if not.
+        * OBSOLETE, use canApiHighLimits() instead
         */
        public function isSysop() {
                if (!isset ($this->mIsSysop)) {
@@ -493,6 +495,15 @@ class ApiMain extends ApiBase {
 
                return $this->mIsSysop;
        }
+       
+       public function canApiHighLimits() {
+               if (!is_null ($this->mCanApiHighLimits)) {
+                       global $wgUser;
+                       $this->mCanApiHighLimits = $wgUser->isAllowed('apihighlimits');
+               }
+
+               return $this->mCanApiHighLimits;
+       }
 
        public function getShowVersions() {
                return $this->mShowVersions;