r84825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84824‎ | r84825 | r84826 >
Date:01:14, 27 March 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 28263) cannot import xml with the api, when have not "import" user right, but "importupload"

Normalised api user right checking to that of SpecialImport, by moving permission checks into specified code paths


Some documentation and explicit variables added while inspecting other code
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiImport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialImport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiImport.php
@@ -42,13 +42,14 @@
4343
4444 public function execute() {
4545 global $wgUser;
46 - if ( !$wgUser->isAllowed( 'import' ) ) {
47 - $this->dieUsageMsg( array( 'cantimport' ) );
48 - }
 46+
4947 $params = $this->extractRequestParams();
5048
5149 $isUpload = false;
5250 if ( isset( $params['interwikisource'] ) ) {
 51+ if ( !$wgUser->isAllowed( 'import' ) ) {
 52+ $this->dieUsageMsg( array( 'cantimport' ) );
 53+ }
5354 if ( !isset( $params['interwikipage'] ) ) {
5455 $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) );
5556 }
Index: trunk/phase3/includes/specials/SpecialImport.php
@@ -37,6 +37,7 @@
3838 private $logcomment= false;
3939 private $history = true;
4040 private $includeTemplates = false;
 41+ private $pageLinkDepth;
4142
4243 /**
4344 * Constructor
@@ -144,8 +145,9 @@
145146
146147 private function showForm() {
147148 global $wgUser, $wgOut, $wgImportSources, $wgExportMaxLinkDepth;
148 - if( !$wgUser->isAllowedAny( 'import', 'importupload' ) )
 149+ if( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
149150 return $wgOut->permissionRequired( 'import' );
 151+ }
150152
151153 $action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) );
152154
@@ -312,6 +314,14 @@
313315 }
314316 }
315317
 318+ /**
 319+ * @param Title $title
 320+ * @param Title $origTitle
 321+ * @param int $revisionCount
 322+ * @param $successCount
 323+ * @param $pageInfo
 324+ * @return void
 325+ */
316326 function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
317327 global $wgOut, $wgUser, $wgLang, $wgContLang;
318328
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -79,6 +79,8 @@
8080 public $uploadFormTextTop;
8181 public $uploadFormTextAfterSummary;
8282
 83+ public $mWatchthis;
 84+
8385 /**
8486 * Initialize instance variables from request and create an Upload handler
8587 *
Index: trunk/phase3/RELEASE-NOTES
@@ -290,6 +290,8 @@
291291 * API upload errors may now return the parameter that needs to be changed and
292292 a sessionkey to fix the error.
293293 * (bug 28249) allow dupes in meta=allmessages&amargs
 294+* (bug 28263) cannot import xml with the api, when have not "import" user
 295+ right, but "importupload"
294296
295297 === Languages updated in 1.18 ===
296298

Follow-up revisions

RevisionCommit summaryAuthorDate
r85138Followup r84825...reedy17:29, 1 April 2011

Comments

#Comment by Duplicatebug (talk | contribs)   15:12, 1 April 2011

But the user does not get a (import) token, because prop=info&intoken=import does not check for user right "importupload".

Status & tagging log