Actually the demo is closed to anonymous users because we have not enough time to fight for spam.
Anyway, we can deny editing via some MediaWiki's hooks while allowing editing again, to restore [edit] buttons etc.
Actually the demo is closed to anonymous users because we have not enough time to fight for spam.
Anyway, we can deny editing via some MediaWiki's hooks while allowing editing again, to restore [edit] buttons etc.
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | ValerioBoz-WMCH | T256472 Release Minipedia demo | |||
Resolved | ValerioBoz-WMCH | T259234 Allow to emulate editing in Minipedia but restricting editing |
Since we are still waiting for T256455: Create WMCH infrastructure repository and we cannot auto-link the commit resolving this... let's manually do it for documentation purposes:
--- a/servers/demo/projects/minipedia/LocalSettings.php +++ b/servers/demo/projects/minipedia/LocalSettings.php @@ -115,7 +115,24 @@ $wgDiff3 = "/usr/bin/diff3"; # The following permissions were set based on your choice in the installer $wgGroupPermissions['*']['createaccount'] = false; -$wgGroupPermissions['*']['edit'] = false; + +// this is just a demo, we do not have enough time to fight spam +// anyway, let's block editing via an hook, instead of via privileges, or the UI changes +// $wgGroupPermissions['*']['edit'] = true; + +// block editing via an hook if you are not registered-in +$wgHooks['EditFilter'][] = function ( $editor, $text, $section, &$error, $summary ) { + + // only logged-in users can write + global $wgUser; + if( ! ( StubObject::isRealObject( $wgUser ) && $wgUser->isLoggedIn() ) ) { + $error = sprintf( + '<div class="errorbox">%s</div>', + "Apologies, it's just a demo :) Please request an account." + ); + return true; + } +};
― https://gitpull.it/R43:2601476d30d950aa5de2a72e19993e424dc875a7