Extension:NamespaceProtection

What can this extension do?
In MediaWiki version 1.10, namespace protection capability is a newly available function that provides the capability to protect pages in entire namespaces from editing, moving, etc by unauthorized users.

This is accomplished by establishing namespace protection definitions for those namespaces you wish to protect, which are assigned to an array called $wgNamespaceProtection. A custom user group is then created that has the namespace protection definitions assigned to it through $wgGroupPermissions. Finally, users are assigned to the custom user group through the Special:Userrights page (which must be done by bureaucrats or others with userright permissions).

Once this is completed, any users assigned to the custom group that has the associated namespace protection definitions will have edit access to the articles in the assigned namespace.

Example
1. Establish a custom namespace called "Custom1", and the associated talk space called "Custom1 Talk" by adding the following to LocalSettings.php:

$wgExtraNamespaces = array (100 => "Custom1", 101 => "Custom1 Talk");

2. Establish a namespace protection definition by adding the following to LocalSettings.php:

$wgNamespaceProtection[100] = array('edit100');

3. Establish a new user group with the namespace protection definitions for the "Custom1" namespace by adding the following to LocalSettings.php:

$wgGroupPermissions['Custom1' ]['edit100'] = true;

4. Assign users to the "Custom1" usergroup through the Special:Userrights page (must have 'userrights' permissions to do this; by default any user in the "bureaucrat" group can do this.

Once this is completed, only users assigned to the "Custom1" user group will have edit access to the articles in the namespace "Custom1".

To give sysops the ability to edit pages in the "Custom1" namespace, insert the following in LocalSettings.php as well:

$wgGroupPermissions['sysop']['edit100'] = true;

Installation / Changes to LocalSettings.php
Save the code below in your extensions folder of your MediaWiki installation as NamespaceProtection.php. Add the custom namespace permissions and custom group permissions (following the example above). Add the following to the end of LocalSettings.php to activate the extension:

require_once('extensions/NamespaceProtection.php');

Code
'''Copy the following code and save as "extensions/NamespaceProtection.php":

MediaWiki Versions
This extension has been tested and appears to work fine on MediaWiki version 1.6.10. Once the extension has been fully tested (probably over the next 30 days) this page will be updated and the extension will be released as a stable version.