(Voir le billet en français)
This patch is deprecated.
Here is a patch to enable article restriction under MediaWiki. Pages can be articles or categories. It adds a new |restrict| tab link allowing members of the group restrict
to restrict pages. Users member of the group viewrestrict
can read (and modify) the restricted pages. Others users cannot see, search, export, etc, the restricted pages. You can still |protect| them for editing. A restricted page is distinguished by a red background tab, and you have a special page (Special:Restrictedpages) to list the restricted pages. All restriction/unrestriction actions are loggued in the wiki log. It is also possible to restrict pages or namespaces by providing a regular expression array matching titles, and to restrict new pages by default. Optionaly the user's pages can be restricted to their owner. Currently it is localized in English, German, Dutch, Swedish, Catalan, Finnish, Russian, Hebrew, Polish, Czech, Spanish and French.
This feature is mainly useful for intranet relying on WikiMedia as a non-encyclopedic content management system, like e-learning platforms or informational systems. To respect the wiki philosophy, it is not appropriate to use it to restrict public access!
To install restriction-patch
, download MediaWiki (do a security backup if you patch your own installation), or see below to dowload a pre-patched archive.
mv restriction-version.mediawiki-version.patch ./mediawiki-version cd ./mediawiki-version patch -p0 < restriction-version.mediawiki-version.patch
First, install MediaWiki as usual (to create the database and the LocalSettings.php file). Once your wiki works fine you have to enable restriction. It is disabled by default. So add in your ./LocalSettings.php
file (at the bottom of the file) :
* If true, a new menu action allows to restrict pages access to 'restrict' group users.
* If false, all previously restricted pages are accessible again.
$wgEnableRestrict = true;
* If true, new pages are restricted by default for 'restrict' group users.
$wgRestrictNewPages = false;
* If true restrict user pages to their owner (as well as viewrestrict/restrict members)
$wgUserPageRestrict = false;
* when wgUserPageRestrict and this option are true, allows user pages to be read but not edited by others?
* added to restrict version beta-0.8.2
$wgUserReadRestrict = false;
* Regular expression array to restrict matching pages
* eg. $wgRegexRestrict = array("^Secure:", "^Secret ");
* restrict all pages where title is like 'Secure:...' or 'Secret ...'
* with restrict version beta-0.8.1 you can also use Inverse regex matching
* eg. $wgRegexRestrict = array("!!Public.*", ".*");
* any pages starting with "Public" is un-restricted and all others are restricted.
$wgRegexRestrict = array();
* If true do not add recent changes entry for restricted pages
$wgNoRecentChangesRestrict = true;
* If true hide log entries related to restriction, except for 'restrict' or 'viewrestrict' users (Special:Log page)
$wgHideRestrictLog = true;
* MediaWiki permissions setup
$wgGroupPermissions['restrict']['restrict'] = true;
$wgGroupPermissions['restrict']['viewrestrict'] = true;
$wgGroupPermissions['viewrestrict']['viewrestrict'] = true;
// with restrict version beta-0.8.2 when $wgUserPageRestrict and $wgUserReadRestrict is true
// 'authors' group members get 'edituser' rights and can edit other users pages and sub pages.
$wgGroupPermissions['authors']['edituser'] = true;
By default nobody is able to restrict page. Go to the User rights management
page (in special pages) and add users in group restrict
(allow to view and restrict pages) or viewrestrict
(allow only to view restricted pages). Here is a FAQ on metawiki
If $wgUserPageRestrict is true, user pages are restricted to their respective owner, as well as members of the viewrestrict
Don't write sensible information in page titles, they could be retrieved in some cases. This is beta
and GPL, test and feedback welcome !
Get the patch
Mailing list and contact
You can subscribe to the mailing list to discuss about this patch, receive news, etc. Send an empty mail to restrict-mediawiki-list-subscribe@...
and reply to the confirmation mail.
To contact me (no personal support, use this blog) : restrict-mediawiki/at/conseil-recherche-innovation.net
Version beta-0.72 for MW 1.6.6/1.6.7/1.6.8 (09-01-2006)
- Spanish translation (thanks to Victor Fariña from Queres tecnologias)
- Czech translation (thanks to Michal Ciza)
Version beta-0.71 for MW 1.6.6/1.6.7 (07-13-2006)
- Two bugs in Articles.php and Skin.php (thanks to Owen, see here)
Version beta-0.70 for MW 1.6.6/1.6.7 (06-06-2006)
- SQL requests are not modified anymore to check the restriction (better sustenability of the patch)
- Now restricted pages and *regex* restricted pages are treated in the same way. So none of pages title should be listed whatever the protection mechanism choosed, nor during a search request
- Regex restriction include the namespace, so it is now possible to restrict whole namespaces (eg. "^Talk:" restrict all talk pages)
- Image partialy restricted (not listed but file accessible via HTTP)
- The SpecialVersion page informs that MW is patched
- Correction of text error on the unrestrict page (thanks to Mathaba)
- Polish translation (thanks to Janusz 'Ency' Dorozynski)
Version beta-0.64 for MW 1.6.3 (05-01-2006)
- Bug in SpecialCategories page (thanks to T O X I N)
- Hebrew translation (thanks to Yuval Hager)
- Bug in OutputPage.php (thanks again to Yuval Hager)
Version beta-0.63 for MW 1.6.3 (04-20-2006)
- Upgrade for 1.6.3 (thanks to Anthony for his help)
- Russian translation (thanks to T O X I N)
- Finnish translation (thanks to Tuomas Helin)
Version beta-0.62 for MW 1.5.5/1.5.6 (02-13-2005)
- Catalan translation (thanks to Pau Cabot)
- Small mistake (comma) in swedish translation
Version beta-0.61 for MW 1.5.5/1.5.6 (01-18-2006)
- Swedish translation (thanks to Samuel Lampa)
- Dutch translation (thanks to Peter De Baets)
Version beta-0.6 for MW 1.5.3 (12-15-2005)
- $wgHideRestrictLog option is back
Version beta-0.59 for MW 1.5.1/1.5.2 (10-31-2005)
- Allow to restrict new pages by default ($wgRestrictNewPages option)
- Bug : 'ArticleProtectComplete' hook function remplaced by 'ArticleRestrictComplete' (stupid mistake !)
Version beta-0.58 (10-07-2005)
- Restriction by regular expression test on title.
- Bug which avoided to view restricted pages in special pages (only 'restrict' group can see it, not possible to add 'viewrestrict' group) (thanks to Karen O'Flaherty)
- German translation updated (thanks to Hugo Wirz)
- French and english translations updated.
- Bug in Broken Redirects special page SQL request
- Categories special page hide restricted categories for non allowed users
- No more modifications in monobook stylesheet than one style added (see bottom of /skins/monobook/main.css file).
Version beta-0.57 (09-18-2005)
- Stupid cosmetic bug which avoid patch working if user page restriction enabled (thanks to Christophe Berger)
Version beta-0.56 (09-11-2005)
- Bug "variables can be passed by reference in mediawiki\includes\Article.php on line 1703" with some PHP configurations (thanks to Chunho Lee)
Version beta-0.55 (09-07-2005)
- First public release for MediaWiki 1.5