Merge "Perform a permission check on the title when changing the page language"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 14 Aug 2017 16:48:17 +0000 (16:48 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 14 Aug 2017 16:48:17 +0000 (16:48 +0000)
1  2 
includes/specials/SpecialPageLanguage.php

@@@ -135,8 -135,18 +135,18 @@@ class SpecialPageLanguage extends FormS
                        return Status::newFatal( $ex->getMessageObject() );
                }
  
+               // Check permissions and make sure the user has permission to edit the page
+               $errors = $title->getUserPermissionsErrors( 'edit', $this->getUser() );
+               if ( $errors ) {
+                       $out = $this->getOutput();
+                       $wikitext = $out->formatPermissionsErrorMessage( $errors );
+                       // Hack to get our wikitext parsed
+                       return Status::newFatal( new RawMessage( '$1', [ $wikitext ] ) );
+               }
                // Url to redirect to after the operation
 -              $this->goToUrl = $title->getFullURL(
 +              $this->goToUrl = $title->getFullUrlForRedirect(
                        $title->isRedirect() ? [ 'redirect' => 'no' ] : []
                );