Extension:UserProtect

From Linux Web Expert

<translate> This extension is professionally maintained by the WikiTeq team.</translate>
<translate> WikiTeq provides official support for [[<tvar name=1>Special:MyLanguage/Version lifecycle</tvar>|MediaWiki LTS releases only]].</translate> <translate> It may work with other MediaWiki releases.</translate>
MediaWiki extensions manual
UserProtect
Release status: beta
File:UserProtect Interface.png
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 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').
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

  • 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

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

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

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/UserProtect</tvar>|Download]] and move the extracted <tvar name=name>UserProtect</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/UserProtect
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'UserProtect' );
    
  • <translate> Run the [[<tvar name=update>Special:MyLanguage/Manual:Update.php</tvar>|update script]] which will automatically create the necessary database tables that this extension needs.</translate>
  • Configure as required.
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Configuration

Parameters

$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

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