From: Chad Horohoe Date: Mon, 4 Aug 2008 14:26:20 +0000 (+0000) Subject: Display permissions specific to the API (such as writeapi and apihighlimits) on actio... X-Git-Tag: 1.31.0-rc.0~46148 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=6959321d61a29023f5793bad23c872fe5a748a11;p=lhc%2Fweb%2Fwiklou.git Display permissions specific to the API (such as writeapi and apihighlimits) on action=help. For apihighlimits, give the limits they're held to (bug 14713) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0c1ec67b75..268e0452cd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -67,6 +67,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN This means you can use API search on Wikipedia without explicitly adding &srwhat=text to the query. * Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages +* API-specific permissions (such as 'writeapi' and 'apihighlimits' are now + listed on action=help === Languages updated in 1.14 === diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 63e53776ec..d81dfc851f 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -99,6 +99,19 @@ class ApiMain extends ApiBase { 'dbg' => 'ApiFormatDbg', 'dbgfm' => 'ApiFormatDbg' ); + + /** + * List of user roles that are specifically relevant to the API. + * array( 'right' => array ( 'msg' => 'Some message with a $1', + * 'params' => array ( $someVarToSubst ) ), + * ); + */ + private static $mRights = array( 'writeapi' => array( 'msg' => 'Use of the write API' , + 'params' => array() ), + 'apihighlimits' => array( 'msg' => 'Use higher limits in API queries (Slow queries: $1 results; Fast queries: $2 results)', + 'params' => array ( ApiMain :: LIMIT_SML2, ApiMain :: LIMIT_BIG2 ) ), + ); + private $mPrinter, $mModules, $mModuleNames, $mFormats, $mFormatNames; private $mResult, $mAction, $mShowVersions, $mEnableWrite, $mRequest, $mInternalMode, $mSquidMaxage; @@ -525,6 +538,14 @@ class ApiMain extends ApiBase { $msg .= "\n"; } + $msg .= "\n$astriks Permissions $astriks\n\n"; + foreach ( self :: $mRights as $right => $rightMsg ) { + $groups = User::getGroupsWithPermission( $right ); + $msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg[ 'msg' ], $rightMsg[ 'params' ] ) . + "\nGranted to:\n " . str_replace( "*", "all", implode( ", ", $groups ) ) . "\n"; + + } + $msg .= "\n$astriks Formats $astriks\n\n"; foreach( $this->mFormats as $formatName => $unused ) { $module = $this->createPrinterByName($formatName);