Gerrit Patch Uploader has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/343333 )

Change subject: Perform a permission check on the title when changing the page 
language
......................................................................

Perform a permission check on the title when changing the page language

Performing this check will prevent users without the edituserjs/css to change 
the page language for protected user js/css subpages, similar to 
Special:Editcontentmodel.

Bug: T160783
Change-Id: I2b106861ea0a488308cda92baf7ebf697844ffd7
---
M includes/specials/SpecialPageLanguage.php
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/33/343333/1

diff --git a/includes/specials/SpecialPageLanguage.php 
b/includes/specials/SpecialPageLanguage.php
index db05ebe..03be214 100644
--- a/includes/specials/SpecialPageLanguage.php
+++ b/includes/specials/SpecialPageLanguage.php
@@ -135,6 +135,18 @@
                        return Status::newFatal( $ex->getMessageObject() );
                }
 
+               // Check permissions and make sure the user has permission to:
+               $errors = wfMergeErrorArrays(
+               // change the page language of the page
+                       $title->getUserPermissionsErrors( 'pagelang', 
$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(
                        $title->isRedirect() ? [ 'redirect' => 'no' ] : []

-- 
To view, visit https://gerrit.wikimedia.org/r/343333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b106861ea0a488308cda92baf7ebf697844ffd7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>
Gerrit-Reviewer: Mainframe98 <k.s.w...@hotmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to