Jump to content

Extension:UserProtect

From mediawiki.org
This extension is professionally maintained by the WikiTeq team.
WikiTeq provides official support for MediaWiki LTS releases only. It may work with other MediaWiki releases.
MediaWiki extensions manual
UserProtect
Release status: beta
Implementation User rights
Description Straightforward per-user per-right per-page protection
Author(s) Pavel Astakhov (pastakhovtalk)
Maintainer(s) WikiTeq team
Latest version 1.0
Compatibility policy For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension.
MediaWiki 1.35
Database changes Yes
Tables user_protect_rights
user_protect_titles
License GNU General Public License 2.0 or later
Download
README
  • $wgUserProtectRestrictionTypes
userprotect
Quarterly downloads 10 (Ranked 119th)
Translate the UserProtect extension if it is available at translatewiki.net
Issues Open tasks ¡ Report a bug

The UserProtect extension provides straightforward per-user per-right per-page protection. It allows those with the userprotect right (administrators by default) to use a page protection tool that is similar to the way the core MediaWiki Protect action works. It allows adding rights or removing rights on a per-page basis. It cannot restrict the viewing of any pages.

This extension was created for WikiWorks.

Features

[edit]
  • Stores its data in the MediaWiki database.
  • Doesn't disable caching.
  • Has a minimalist interface
  • Adds and removes rights on the fly.
  • Overrides the built-in core per-group protection system with finer per-user protection.

Usage

[edit]

A user with the userprotect right is provided with the "User protect" item in the page actions menu. Click it to add or remove allowed restrictions to the current page on per-user basis. Just start typing user names in the appropriate right field. Each field allows multiple values and autocompletes as you type. Once you are done, submit the form.

The "All rights" field

[edit]

The "All rights" field is a convenience field. It doesn't add/remove every right in the permissions system, but rather every right that can be seen on the UserProtect page. So it's the equivalent of putting a user name in all of the fields individually. Of note, if the $wgUserProtectRestrictionTypes global is later changed, that will affect any user with "All rights" accordingly.

Installation

[edit]
  • Download and move the extracted UserProtect folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UserProtect
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'UserProtect' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Configure as required.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

[edit]

Parameters

[edit]
$wgUserProtectRestrictionTypes
Sets which user rights can be modified by the extension. Defaults to:
$wgUserProtectRestrictionTypes = [
   'edit' => true,
   'move' =>  true,
   'delete' => true
];
For example, you can add to your "LocalSettings.php" file:
$wgUserProtectRestrictionTypes['delete'] = false; # Turn off the extension's ability to modify the delete right.
$wgUserProtectRestrictionTypes['rollback'] = true; # Turn on the extension's ability to modify the rollback right.
Also, this extension adds the userprotect right which controls which users can use the UserProtect page to change the rights of other users (or their own). This right can be granted to individual users for particular pages by adding:
$wgUserProtectRestrictionTypes['userprotect'] = true; # Turn on the extension's ability to modify the userprotect right.
The extension will probably work with any MediaWiki core or extension page-related right, but it has not been tested with all of them. It does not work with the "read" right.

User rights

[edit]
userprotect
Allows users to use the "UserProtect" page action in order to add or remove user rights for this page. Defaults to:
$wgGroupPermissions['sysop']['userprotect'] = true;

See also

[edit]