Extension:ToggleAnonRights
<translate> This extension stores its source code on a wiki page.</translate> <translate> Please be aware that this code may be unreviewed or maliciously altered.</translate> <translate> They may contain security holes, outdated interfaces that are no longer compatible etc.</translate> <translate> Note:</translate> <translate> No [[<tvar name=localisation>Special:MyLanguage/Localisation#Translation resources</tvar>|localisation]] updates are provided for this extension by <tvar name=twn>translatewiki.net </tvar>.</translate> |
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
Toggle Anon Rights Release status: unmaintained |
|
---|---|
Implementation | User rights |
Description | On-wiki toggling of anonymous users' permissions |
Author(s) | Ryan Schmidt (Skizzerztalk) |
Latest version | 1.2.1 |
MediaWiki | 1.11+ |
License | Public domain |
Download | ToggleAnonRights.php |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Usage
This extension allows anyone with the 'editinterface' permission to revoke permissions from anonymous users in emergency situations. This may be useful, for example, to prevent anonymous users from creating accounts when one has a large flood of automated account creations.
To use this extension, edit MediaWiki:Anonrights and add a bulleted list of rights to revoke from anonymous users, for example, the following in the page source would revoke their rights to edit and create new accounts:
* edit * createaccount
Also, this can only be used to remove existing rights from anonymous users. You cannot add rights this way.
Removable rights
ToggleAnonRights allows removal of the following rights, in addition to other rights that anonymous users may receive:
* createaccount * read * edit * createpage * createtalk * writeapi
Download instructions
Please cut and paste the code found below and place it in $IP/extension/ToggleAnonRights/ToggleAnonRights.php
. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.
Installation
To install this extension, add the following to the end of LocalSettings.php:
require_once("$IP/extensions/ToggleAnonRights/ToggleAnonRights.php");
ToggleAnonRights.php
<?php
/**
* Toggle Anon Rights extension for MediaWiki
* Allows toggling of various anonymous group permissions
* Add rights in bulleted list format to globally disable them for anons, remove from the list to re-enable
* THIS CAN ONLY BE USED TO REMOVE RIGHTS, NOT ADD THEM!
*
* @file
* @ingroup Extensions
* @version 1.2.1
* @author Ryan Schmidt
* @link http://www.mediawiki.org/wiki/Extension:ToggleAnonRights Documentation
*/
if( !defined( 'MEDIAWIKI' ) ) {
echo( 'This file is an extension to the MediaWiki software and cannot be used standalone' );
die( 1 );
}
// Extension credits that will show up on Special:Version
$wgExtensionCredits['other'][] = array(
'name' => 'Toggle Anon Rights',
'version' => '1.2.1',
'author' => 'Ryan Schmidt',
'url' => 'http://www.mediawiki.org/wiki/Extension:ToggleAnonRights',
'description' => "On-wiki toggling of anonymous users' permissions",
);
$wgHooks['UserGetRights'][] = 'ToggleAnonRights';
function ToggleAnonRights( $user, &$aRights ) {
if( $user->isLoggedIn() ) {
// don't do anything, but return true to continue hook processing
return true;
}
$pages = explode( "\n", wfMessage( 'anonrights' )->text() );
foreach( $pages as $value ) {
$right = trim( trim( trim( trim( $value ), "*" ) ), "*" ); // make sure ALL whitespace is removed
$key = array_search( $right, $aRights );
if( $key !== false ) {
array_splice( $aRights, $key, 1 );
}
}
return true;
}
- Pages with script errors
- Pages with broken file links
- Extensions which host their code in-wiki
- Unmaintained extensions
- Extensions without an image
- User rights extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- Public domain licensed extensions
- UserGetRights extensions
- All extensions
- Extensions not in ExtensionJson