r54194 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54193‎ | r54194 | r54195 >
Date:08:31, 2 August 2009
Author:shinjiman
Status:ok
Tags:
Comment:
Added back 'editusercssjs' right for regression and backward compatibility, per Code Review on r54153.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1282,11 +1282,14 @@
12831283 # XXX: this might be better using restrictions
12841284 # XXX: Find a way to work around the php bug that prevents using $this->userCanEditCssSubpage()
12851285 # and $this->userCanEditJsSubpage() from working
1286 - if( $this->isCssSubpage() && !$user->isAllowed('editusercss' ) && $action != 'patrol'
 1286+ # XXX: right 'editusercssjs' is deprecated, for backward compatibility only
 1287+ if( $this->isCssSubpage() && ( !$user->isAllowed('editusercssjs') || !$user->isAllowed('editusercss') )
 1288+ && $action != 'patrol'
12871289 && !preg_match('/^'.preg_quote($user->getName(), '/').'\//', $this->mTextform) )
12881290 {
12891291 $errors[] = array('customcssjsprotected');
1290 - } else if( $this->isJsSubpage() && !$user->isAllowed('edituserjs' ) && $action != 'patrol'
 1292+ } else if( $this->isJsSubpage() && ( !$user->isAllowed('editusercssjs') || !$user->isAllowed('edituserjs') )
 1293+ && $action != 'patrol'
12911294 && !preg_match('/^'.preg_quote($user->getName(), '/').'\//', $this->mTextform) )
12921295 {
12931296 $errors[] = array('customcssjsprotected');
@@ -1725,7 +1728,8 @@
17261729 */
17271730 public function userCanEditCssSubpage() {
17281731 global $wgUser;
1729 - return ( $wgUser->isAllowed('editusercss') || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
 1732+ return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('editusercss') )
 1733+ || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
17301734 }
17311735 /**
17321736 * Protect js subpages of user pages: can $wgUser edit
@@ -1736,7 +1740,8 @@
17371741 */
17381742 public function userCanEditJsSubpage() {
17391743 global $wgUser;
1740 - return ( $wgUser->isAllowed('edituserjs') || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
 1744+ return ( ( $wgUser->isAllowed('editusercssjs') && $wgUser->isAllowed('edituserjs') )
 1745+ || preg_match('/^'.preg_quote($wgUser->getName(), '/').'\//', $this->mTextform) );
17411746 }
17421747
17431748 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r54247Added back 'right-editusercssjs' message for backward compatibility, for r54194....shinjiman00:11, 3 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54153* (bug 12110) Split the rights for editing users' CSS/JS subpage from "editus...shinjiman16:44, 1 August 2009

Status & tagging log