* (bug 28263) cannot import xml with the api, when have not "import" user right,...
authorSam Reed <reedy@users.mediawiki.org>
Sun, 27 Mar 2011 01:14:57 +0000 (01:14 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sun, 27 Mar 2011 01:14:57 +0000 (01:14 +0000)
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

RELEASE-NOTES
includes/api/ApiImport.php
includes/specials/SpecialImport.php
includes/specials/SpecialUpload.php

index 423b023..200e991 100644 (file)
@@ -290,6 +290,8 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * API upload errors may now return the parameter that needs to be changed and
   a sessionkey to fix the error.
 * (bug 28249) allow dupes in meta=allmessages&amargs
+* (bug 28263) cannot import xml with the api, when have not "import" user
+  right, but "importupload"
 
 === Languages updated in 1.18 ===
 
index f2c9bde..c497b9c 100644 (file)
@@ -42,13 +42,14 @@ class ApiImport extends ApiBase {
 
        public function execute() {
                global $wgUser;
-               if ( !$wgUser->isAllowed( 'import' ) ) {
-                       $this->dieUsageMsg( array( 'cantimport' ) );
-               }
+
                $params = $this->extractRequestParams();
 
                $isUpload = false;
                if ( isset( $params['interwikisource'] ) ) {
+                       if ( !$wgUser->isAllowed( 'import' ) ) {
+                               $this->dieUsageMsg( array( 'cantimport' ) );
+                       }
                        if ( !isset( $params['interwikipage'] ) ) {
                                $this->dieUsageMsg( array( 'missingparam', 'interwikipage' ) );
                        }
index 7bb7950..431f1a0 100644 (file)
@@ -37,6 +37,7 @@ class SpecialImport extends SpecialPage {
        private $logcomment= false;
        private $history = true;
        private $includeTemplates = false;
+       private $pageLinkDepth;
 
        /**
         * Constructor
@@ -144,8 +145,9 @@ class SpecialImport extends SpecialPage {
 
        private function showForm() {
                global $wgUser, $wgOut, $wgImportSources, $wgExportMaxLinkDepth;
-               if( !$wgUser->isAllowedAny( 'import', 'importupload' ) )
+               if( !$wgUser->isAllowedAny( 'import', 'importupload' ) ) {
                        return $wgOut->permissionRequired( 'import' );
+               }
 
                $action = $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) );
 
@@ -312,6 +314,14 @@ class ImportReporter {
                }
        }
 
+       /**
+        * @param Title $title
+        * @param Title $origTitle
+        * @param int $revisionCount
+        * @param  $successCount
+        * @param  $pageInfo
+        * @return void
+        */
        function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
                global $wgOut, $wgUser, $wgLang, $wgContLang;
 
index b17615c..5aaa0f1 100644 (file)
@@ -79,6 +79,8 @@ class SpecialUpload extends SpecialPage {
        public $uploadFormTextTop;
        public $uploadFormTextAfterSummary;
 
+       public $mWatchthis;
+
        /**
         * Initialize instance variables from request and create an Upload handler
         *