Part III of this tutorial covers setting up your own namespace protections and group permissions to customize the editing access to your wiki.
MediaWiki, by design, is set up to allow pretty liberal access for reading and editing. Namespace protections were established to provide administrators with some ability to limit editing access to the wiki without installing any extensions.
Namespace protections do not grant additional rights to users; you use your Group Permissions to do that. Namespace protections are used to restrict a right that has been granted; most administrators use namespace protections to restrict editing of certain namespaces to specified groups. This tutorial will cover a few examples of some of the more commonly requested settings on the forums.
Provide edit access to anonymous users to discussion pages only
This can be accomplished by setting up a namespace protection that is granted to registered users.
If you remember from Part I, anonymous users by default can edit or create pages on the wiki without registering. By restricting edit access to article namespaces you can grant access to anonymous users to discussion pages only.
Step I: Set up a namespace protection for article pages
Add the following to LocalSettings.php:
Code:
$wgNamespaceProtection[NS_MAIN] =
$wgNamespaceProtection[NS_USER] =
$wgNamespaceProtection[NS_PROJECT] =
$wgNamespaceProtection[NS_FILE] =
$wgNamespaceProtection[NS_IMAGE] =
$wgNamespaceProtection[NS_TEMPLATE] =
$wgNamespaceProtection[NS_HELP] =
$wgNamespaceProtection[NS_CATEGORY] = array('editarticles');
Step II: Add the namespace protection to the Registered Users group
Add the following to LocalSettings.php:
Code:
$wgGroupPermissions['user']['editarticles'] = true;
You're done! Now anonymous users will only be able to edit the discussion pages on your wiki.
Provide read access to registered users only, and edit access to sysops
There is a way to blanket protect your wiki from reading by anonymous users (only anonymous users can be restricted without installing extensions to customize restrictions). You can do this by doing the following:
Step I: Remove edit and read access from anonymous users
Add the following to LocalSettings.php:
Code:
$wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['read'] = false;
Step II: Remove edit permissions from registered users
Add the following to LocalSettings.php:
Code:
$wgGroupPermissions['user']['edit'] = false;
Step III: Grant edit access to sysops
Add the following to LocalSettings.php:
Code:
$wgGroupPermissions['sysop']['edit'] = true;
Whitelisted pages are a special group of pages that are designated as readable to anonymous users when you have otherwise restricted read access to your wiki by setting $wgGroupPermissions['*']['read'] = false;. You need to do this for the login page so that users can access it to log in. You can also designate other pages, such as the main page, as readable by anonymous users as well.
Whitelisted pages are designated using the configuration setting $wgWhitelistRead.
Add the following to LocalSettings.php:
Code:
$wgWhitelistRead = array("Special:Userlogin", "-", "MediaWiki:Monobook.css", "MediaWiki:Common.css", "Main Page");
You're Done! Now only logged in users can read your wiki pages, and only sysops can edit.
Granting Registered users with Read Only access the ability to edit pages in the User namespace and discussion pages
This is designed to go with the previous topic
When you restrict read access to registered users as described above, you may want to grant them the ability to edit pages in the User namespace (allowing them to edit their user page) and the discussion pages. You can do this by setting up a namespace protection for all pages except the user namespace and the discussion pages, and then giving that protection to sysops only.
Step I: Set up a namespace protection for all Article namespaces except the User namespace
Add the following to LocalSettings.php:
Code:
$wgNamespaceProtection[NS_MAIN] =
$wgNamespaceProtection[NS_PROJECT] =
$wgNamespaceProtection[NS_FILE] =
$wgNamespaceProtection[NS_IMAGE] =
$wgNamespaceProtection[NS_TEMPLATE] =
$wgNamespaceProtection[NS_HELP] =
$wgNamespaceProtection[NS_CATEGORY] = array('editarticles');
Add the following to LocalSettings.php:
Code:
$wgGroupPermissions['user']['edit'] = true; //Note this is different from the setting in the previous topic $wgGroupPermissions['sysop']['editarticles'] = true;


Sections
Categories