From 1a55513b863e98255c52f451cbb718b445c4f74b Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 11 Dec 2008 21:37:48 +0000 Subject: [PATCH] Loosen requirements for cascading protection: instead of requiring that both edit=sysop and move=sysop (and any other custom restriction types be set to sysop as well), just require edit=sysop and leave the other restriction types alone. This makes it possible to protect a page with e.g. edit=sysop and move=autoconfirmed and still use cascading protection, but only through the API: the UI won't do this (yet) because the JS greys out the cascade checkbox (that'll need to be fixed). --- RELEASE-NOTES | 2 ++ includes/Article.php | 11 ++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e406fb142e..6c1cf8a151 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -218,6 +218,8 @@ The following extensions are migrated into MediaWiki 1.14: * Added complimentary function for addHandler() called removeHandler() for removing events * Improved security of file uploads for IE clients, using a reverse-engineered algorithm very similar to IE's content detection algorithm. +* Cascading protection no longer requires that both edit and move are restricted + to sysop, just edit=sysop is enough === Bug fixes in 1.14 === diff --git a/includes/Article.php b/includes/Article.php index b2fa9b4daa..6a3ecaec2a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1884,13 +1884,10 @@ class Article { # Only restrictions with the 'protect' right can cascade... # Otherwise, people who cannot normally protect can "protect" pages via transclusion - foreach( $limit as $action => $restriction ) { - # FIXME: can $restriction be an array or what? (same as fixme above) - if( $restriction != 'protect' && $restriction != 'sysop' ) { - $cascade = false; - break; - } - } + $editrestriction = isset( $limit['edit'] ) ? array( $limit['edit'] ) : $this->mTitle->getRestrictions( 'edit' ); + # The schema allows multiple restrictions + if(!in_array('protect', $editrestriction) && !in_array('sysop', $editrestriction)) + $cascade = false; $cascade_description = ''; if( $cascade ) { $cascade_description = ' ['.wfMsgForContent('protect-summary-cascade').']'; -- 2.20.1