jenkins-bot has submitted this change and it was merged. ( 
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
Bug: T74965
Change-Id: I2b106861ea0a488308cda92baf7ebf697844ffd7
---
M includes/specials/SpecialPageLanguage.php
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialPageLanguage.php 
b/includes/specials/SpecialPageLanguage.php
index db05ebe..ef034fb 100644
--- a/includes/specials/SpecialPageLanguage.php
+++ b/includes/specials/SpecialPageLanguage.php
@@ -135,6 +135,16 @@
                        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(
                        $title->isRedirect() ? [ 'redirect' => 'no' ] : []

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b106861ea0a488308cda92baf7ebf697844ffd7
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Kunalgrover05 <[email protected]>
Gerrit-Reviewer: Mainframe98 <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Zppix <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to