Extension:PageEditRestrictions

The PageEditRestrictions extension provides a way to restrict editing to a page, by matching that page with a regular expression. Access is decided by:
 * Matching a verified e-mail address to the logged in user's e-mail address.
 * MediaWiki user group rights configuration

Usage
This extension allows you to restrict editing to a page, by matching that page with a regular expression on the  page. This expression can also be prefixed by an index followed by a hashtag. This will make only conditions also prefixed by the same index apply to that page.

These conditions need to be listed on, where any wikitext can be used, where $1 will be replaced with the email address of the user trying to edit the page, and $2 will be replaced with the page name of the page that is being edited. Again, conditions can be prefixed with an index and a hashtag, which will restrict that condition to only be applied to the pages that matched a regular expression which both had an index defined to it, and for which that index matches this index.

If the condition does not name a specific address, but instead starts with an @ sign, all email addresses within that domain will be matched.

Conditions are case-insensitive, regular expressions for pages are not.

---

MediaWiki:Pageeditrestrictions-restricted-pages

 * 1) List conditions to test the user's email address against.
 * 2) If one of the conditions is met, editing access will be granted.
 * 3) Use $1 in place of the user's email address and $2 in place of the page name.
 * 4) Lines starting with a # will be ignored.
 * 5) this page includes preloaded examples

^(Foo.*Bar|Bar.*Foo) 1 # ^Main page$ ^User:.*/private ^Project:.*

MediaWiki:Pageeditrestrictions-condition

 * 1) lines starting with # are a comment.
 * 2) List conditions to test the user's email address against.
 * 3) If one of the conditions is met, editing access will be granted.
 * 4) Use $1 in place of the user's email address and $2 in place of the page name.


 * 1) this page includes preloaded examples

1 # admin@example.com 1 # @allowed-domain.com

2 # unapplied@example.com

In this example we use two example templates to verify an email address. However this can be configured as desired. Usage of, for example, Semantic MediaWiki is possible.





These example pages will restrict any page that contains both Foo and Bar in its name to be edited only by the email address that results from. This comes down to john.doe@example.com being allowed to edit the article Foo Bar, and somebody@example.com being allowed to edit all of the other matched articles for this rule. Other than that, gmail.com and hotmail.com email addresses are also allowed to edit those pages, as their email address is returned from. Any other address is disallowed, as the phrase "not allowed" does not match their email address.

On the "Main page" article, only admin@example.com is allowed to edit, but also anybody with an email address on the allowed-domain.com domain. The other conditions are not applied to this page, as it is prefixed by an index.

Finally, the email address unapplied@example.com is not specifically allowed to edit any restricted pages, since it is prefixed by an index that does not match any pages.

Note that using a template will make it possible for any user to change these conditions. It is highly recommended to protect these templates from being edited, to prevent users from granting themselves access by editing the templates to show their own email address.

Version history
Author: Pim Bax
 * Version 1.0 (2017-05-30) - Initial version