MediaWiki r9632 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r9631‎ | r9632 (on ViewVC)‎ | r9633 >
Date:06:24, 25 June 2005
Author:vibber
Status:old
Tags:
Comment:
* (bug 996) Replace $wgWhitelistEdit with 'edit' permission; fixup UPGRADE documentation about edit and read whitelists.
Patch by robla: http://bugzilla.wikimedia.org/attachment.cgi?id=645&action=view
plus doc fixes
Modified paths:

Diff [purge]

Index: trunk/phase3/UPGRADE
@@ -48,11 +48,22 @@
4949 set:
5050 $wgGroupPermissions['*']['createaccount'] = false;
5151
52 -If $wgWhitelistRead is set, things need to be funked around. This needs work.
 52+$wgWhitelistEdit has been replaced by the 'edit' permission key.
 53+To emulate the old effect of setting:
 54+ $wgWhitelistEdit = true;
 55+set:
 56+ $wgGroupPermissions['*']['edit'] = false;
5357
54 -bla bla bla
 58+If $wgWhitelistRead is set, you must also disable the 'read' permission
 59+for it to take affect on anonymous users:
 60+ $wgWhitelistRead = array( "Main Page", "Special:Userlogin" );
 61+ $wgGroupPermissions['*']['read'] = false;
5562
 63+Note that you can disable/enable several other permissions by modifying
 64+this configuration array in your LocalSettings.php; see DefaultSettings.php
 65+for the complete default permission set.
5666
 67+
5768 === Web installer ===
5869
5970 You can use the web-based installer wizard if you first remove the
Index: trunk/phase3/includes/Parser.php
@@ -346,8 +346,8 @@
347347 #$text = str_replace( $uniq_prefix, wfHtmlEscapeFirst( $uniq_prefix ), $text );
348348
349349 # html
350 - global $wgRawHtml, $wgWhitelistEdit;
351 - if( $wgRawHtml && $wgWhitelistEdit ) {
 350+ global $wgRawHtml;
 351+ if( $wgRawHtml ) {
352352 $text = Parser::extractTags('html', $text, $html_content, $uniq_prefix);
353353 foreach( $html_content as $marker => $content ) {
354354 if ($render ) {
Index: trunk/phase3/includes/EditPage.php
@@ -135,7 +135,7 @@
136136 * This is the function that gets called for "action=edit".
137137 */
138138 function edit() {
139 - global $wgOut, $wgUser, $wgWhitelistEdit, $wgRequest;
 139+ global $wgOut, $wgUser, $wgRequest;
140140 // this is not an article
141141 $wgOut->setArticleFlag(false);
142142
@@ -156,9 +156,14 @@
157157 $this->blockedIPpage();
158158 return;
159159 }
160 - if ( $wgUser->isAnon() && $wgWhitelistEdit ) {
161 - $this->userNotLoggedInPage();
162 - return;
 160+ if ( !$wgUser->isAllowed('edit') ) {
 161+ if ( $wgUser->isAnon() ) {
 162+ $this->userNotLoggedInPage();
 163+ return;
 164+ } else {
 165+ $wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
 166+ return;
 167+ }
163168 }
164169 if ( wfReadOnly() ) {
165170 if( $this->save || $this->preview ) {
@@ -282,7 +287,6 @@
283288 global $wgOut, $wgUser;
284289 global $wgLang, $wgContLang, $wgParser, $wgTitle;
285290 global $wgAllowAnonymousMinor;
286 - global $wgWhitelistEdit;
287291 global $wgSpamRegex, $wgFilterCallback;
288292
289293 $sk = $wgUser->getSkin();
@@ -323,10 +327,18 @@
324328 $this->blockedIPpage();
325329 return;
326330 }
327 - if ( $wgUser->isAnon() && $wgWhitelistEdit ) {
 331+
 332+ if ( !$wgUser->isAllowed('edit') ) {
 333+ if ( $wgUser->isAnon() ) {
328334 $this->userNotLoggedInPage();
329335 return;
330336 }
 337+ else {
 338+ $wgOut->readOnlyPage();
 339+ return;
 340+ }
 341+ }
 342+
331343 if ( wfReadOnly() ) {
332344 $wgOut->readOnlyPage();
333345 return;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -654,7 +654,6 @@
655655 # It's not 100% safe, there could be security hole using that one. Use at your
656656 # own risks.
657657
658 -$wgWhitelistEdit = false; # true = user must login to edit.
659658 $wgWhitelistRead = false; # Pages anonymous user may see, like: = array ( "Main Page", "Special:Userlogin", "Wikipedia:Help");
660659
661660 $wgAllowAnonymousMinor = false; # Allow anonymous users to mark changes as 'minor'
@@ -675,14 +674,18 @@
676675 * logged-in users are all implicitly in the 'user' group. These will be
677676 * combined with the permissions of all groups that a given user is listed
678677 * in in the user_groups table.
 678+ *
 679+ * This replaces wgWhitelistAccount and wgWhitelistEdit
679680 */
680681 $wgGroupPermissions = array();
681682
682683 $wgGroupPermissions['*' ]['createaccount'] = true;
683684 $wgGroupPermissions['*' ]['read'] = true;
 685+$wgGroupPermissions['*' ]['edit'] = true;
684686
685687 $wgGroupPermissions['user' ]['move'] = true;
686688 $wgGroupPermissions['user' ]['read'] = true;
 689+$wgGroupPermissions['user' ]['edit'] = true;
687690 $wgGroupPermissions['user' ]['upload'] = true;
688691
689692 $wgGroupPermissions['bot' ]['bot'] = true;
@@ -1160,8 +1163,8 @@
11611164 $wgUserHtml = true;
11621165
11631166 /** Allow raw, unchecked HTML in <html>...</html> sections.
1164 - * THIS IS VERY DANGEROUS on a publically editable site, so you can't enable it
1165 - * unless you've restricted editing to trusted users only with $wgWhitelistEdit.
 1167+ * THIS IS VERY DANGEROUS on a publically editable site, so USE wgGroupPermissions
 1168+ * TO RESTRICT EDITING to only those that you trust
11661169 */
11671170 $wgRawHtml = false;
11681171
Index: trunk/phase3/RELEASE-NOTES
@@ -332,7 +332,10 @@
333333 * (bug 2504) Updated the Finnish translation
334334 * (bug 2506) Updated the Nynorsk translation
335335 * Everything given to setSubtitle() is now parsed for the full wikisyntax
 336+* (bug 996) Replace $wgWhitelistEdit with 'edit' permission; fixup UPGRADE
 337+ documentation about edit and read whitelists.
336338
 339+
337340 === Caveats ===
338341
339342 Some output, particularly involving user-supplied inline HTML, may not

Past revisions this follows-up on

Rev.Commit summaryAuthorDate
r6599* (bug 996) Fix $wgWhitelistRead to work againvibber03:57, 10 December 2004

Status & tagging log

  • 15:03, 12 September 2011 Meno25 (talk | contribs) changed the status of r9632 [removed: ok added: old]
  • 14:05, 18 June 2009 ^demon (talk | contribs) changed the status of r9632 [removed: new added: ok]