| Index: trunk/phase3/UPGRADE |
| — | — | @@ -48,11 +48,22 @@ |
| 49 | 49 | set: |
| 50 | 50 | $wgGroupPermissions['*']['createaccount'] = false; |
| 51 | 51 | |
| 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; |
| 53 | 57 | |
| 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; |
| 55 | 62 | |
| | 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. |
| 56 | 66 | |
| | 67 | + |
| 57 | 68 | === Web installer === |
| 58 | 69 | |
| 59 | 70 | You can use the web-based installer wizard if you first remove the |
| Index: trunk/phase3/includes/Parser.php |
| — | — | @@ -346,8 +346,8 @@ |
| 347 | 347 | #$text = str_replace( $uniq_prefix, wfHtmlEscapeFirst( $uniq_prefix ), $text ); |
| 348 | 348 | |
| 349 | 349 | # html |
| 350 | | - global $wgRawHtml, $wgWhitelistEdit; |
| 351 | | - if( $wgRawHtml && $wgWhitelistEdit ) { |
| | 350 | + global $wgRawHtml; |
| | 351 | + if( $wgRawHtml ) { |
| 352 | 352 | $text = Parser::extractTags('html', $text, $html_content, $uniq_prefix); |
| 353 | 353 | foreach( $html_content as $marker => $content ) { |
| 354 | 354 | if ($render ) { |
| Index: trunk/phase3/includes/EditPage.php |
| — | — | @@ -135,7 +135,7 @@ |
| 136 | 136 | * This is the function that gets called for "action=edit". |
| 137 | 137 | */ |
| 138 | 138 | function edit() { |
| 139 | | - global $wgOut, $wgUser, $wgWhitelistEdit, $wgRequest; |
| | 139 | + global $wgOut, $wgUser, $wgRequest; |
| 140 | 140 | // this is not an article |
| 141 | 141 | $wgOut->setArticleFlag(false); |
| 142 | 142 | |
| — | — | @@ -156,9 +156,14 @@ |
| 157 | 157 | $this->blockedIPpage(); |
| 158 | 158 | return; |
| 159 | 159 | } |
| 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 | + } |
| 163 | 168 | } |
| 164 | 169 | if ( wfReadOnly() ) { |
| 165 | 170 | if( $this->save || $this->preview ) { |
| — | — | @@ -282,7 +287,6 @@ |
| 283 | 288 | global $wgOut, $wgUser; |
| 284 | 289 | global $wgLang, $wgContLang, $wgParser, $wgTitle; |
| 285 | 290 | global $wgAllowAnonymousMinor; |
| 286 | | - global $wgWhitelistEdit; |
| 287 | 291 | global $wgSpamRegex, $wgFilterCallback; |
| 288 | 292 | |
| 289 | 293 | $sk = $wgUser->getSkin(); |
| — | — | @@ -323,10 +327,18 @@ |
| 324 | 328 | $this->blockedIPpage(); |
| 325 | 329 | return; |
| 326 | 330 | } |
| 327 | | - if ( $wgUser->isAnon() && $wgWhitelistEdit ) { |
| | 331 | + |
| | 332 | + if ( !$wgUser->isAllowed('edit') ) { |
| | 333 | + if ( $wgUser->isAnon() ) { |
| 328 | 334 | $this->userNotLoggedInPage(); |
| 329 | 335 | return; |
| 330 | 336 | } |
| | 337 | + else { |
| | 338 | + $wgOut->readOnlyPage(); |
| | 339 | + return; |
| | 340 | + } |
| | 341 | + } |
| | 342 | + |
| 331 | 343 | if ( wfReadOnly() ) { |
| 332 | 344 | $wgOut->readOnlyPage(); |
| 333 | 345 | return; |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -654,7 +654,6 @@ |
| 655 | 655 | # It's not 100% safe, there could be security hole using that one. Use at your |
| 656 | 656 | # own risks. |
| 657 | 657 | |
| 658 | | -$wgWhitelistEdit = false; # true = user must login to edit. |
| 659 | 658 | $wgWhitelistRead = false; # Pages anonymous user may see, like: = array ( "Main Page", "Special:Userlogin", "Wikipedia:Help"); |
| 660 | 659 | |
| 661 | 660 | $wgAllowAnonymousMinor = false; # Allow anonymous users to mark changes as 'minor' |
| — | — | @@ -675,14 +674,18 @@ |
| 676 | 675 | * logged-in users are all implicitly in the 'user' group. These will be |
| 677 | 676 | * combined with the permissions of all groups that a given user is listed |
| 678 | 677 | * in in the user_groups table. |
| | 678 | + * |
| | 679 | + * This replaces wgWhitelistAccount and wgWhitelistEdit |
| 679 | 680 | */ |
| 680 | 681 | $wgGroupPermissions = array(); |
| 681 | 682 | |
| 682 | 683 | $wgGroupPermissions['*' ]['createaccount'] = true; |
| 683 | 684 | $wgGroupPermissions['*' ]['read'] = true; |
| | 685 | +$wgGroupPermissions['*' ]['edit'] = true; |
| 684 | 686 | |
| 685 | 687 | $wgGroupPermissions['user' ]['move'] = true; |
| 686 | 688 | $wgGroupPermissions['user' ]['read'] = true; |
| | 689 | +$wgGroupPermissions['user' ]['edit'] = true; |
| 687 | 690 | $wgGroupPermissions['user' ]['upload'] = true; |
| 688 | 691 | |
| 689 | 692 | $wgGroupPermissions['bot' ]['bot'] = true; |
| — | — | @@ -1160,8 +1163,8 @@ |
| 1161 | 1164 | $wgUserHtml = true; |
| 1162 | 1165 | |
| 1163 | 1166 | /** 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 |
| 1166 | 1169 | */ |
| 1167 | 1170 | $wgRawHtml = false; |
| 1168 | 1171 | |
| Index: trunk/phase3/RELEASE-NOTES |
| — | — | @@ -332,7 +332,10 @@ |
| 333 | 333 | * (bug 2504) Updated the Finnish translation |
| 334 | 334 | * (bug 2506) Updated the Nynorsk translation |
| 335 | 335 | * 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. |
| 336 | 338 | |
| | 339 | + |
| 337 | 340 | === Caveats === |
| 338 | 341 | |
| 339 | 342 | Some output, particularly involving user-supplied inline HTML, may not |