Extension:UserProtect

MediaWiki extensions manual
OOjs UI icon advanced.svg
UserProtect
Release status: beta
UserProtect Interface.png
Implementation User rights
Description Straightforward per-user per-right per-page protection
Author(s) Pavel Astakhov (pastakhovtalk)
Latest version 1.0
MediaWiki > 1.34
Database changes Yes
Tables user_protect_rights
user_protect_titles
License GNU General Public License 2.0 or later
Download
README
  • $wgUserProtectRestrictionTypes
  • userprotect
Translate the UserProtect extension if it is available at translatewiki.net
Check usage and version matrix.

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.

FeaturesEdit

  • 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.

UsageEdit

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" fieldEdit

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.

InstallationEdit

  • Download and place the file(s) in a directory called UserProtect in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'UserProtect' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Configure as required.
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

ConfigurationEdit

ParametersEdit

$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 rightsEdit

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 alsoEdit