Manual talk:$wgNamespaceProtection

How would one use $wgNamespaceProtection to prevent editing of a custom namespace? Say one's got:

$wgGroupPermissions['comics']['read'] = true;

$wgExtraNamespaces = array(100 => "Comics",                          101 => "Comics_talk"                           );

...and I wanted only folks in the 'comics' group to be able to edit the Comics (100) namespace?


 * You'd need something like:

$wgGroupPermissions['comics']['editcomics'] = true; $wgNamespaceProtection[ 100 ] = array( 'editcomics' );
 * --Ilmari Karonen 04:31, 21 May 2007 (UTC)

Restrict editing in the main namespace
The example above restricts editing of the comics namespace.

It is also possible to restrict editing of the main namespace but to keep the comics namespace editing enabled for the group 'comics'.

Use the following additional lines in LocalSettings.php:

$wgGroupPermissions['main']['editmain'] = true; $wgNamespaceProtection[NS_MAIN] = array( 'editmain' );

What File
I can't seem to get this to work. What file is this variable used in? -- Egingell 18:18, 17 August 2007 (UTC)

LocalSettings.php
Example settings in LocalSettings.php. These settings restrict all pages in the 'main' namespace to be "read-only" for users who have not logged in and enable pages in the 'enrichment' namespace to be edited by 'studenteditors'. $wgGroupPermissions['*']['createaccount'] = false;
 * 1) Prevent new user registrations except by sysops

// Implicit group for all anonymous $wgGroupPermissions['*'   ]['createaccount']   = false; $wgGroupPermissions['*'   ]['read']            = true; $wgGroupPermissions['*'   ]['edit']            = false; $wgGroupPermissions['*'   ]['createpage']      = false; $wgGroupPermissions['*'   ]['createtalk']      = false;
 * 1) Disable anonymous editing

// Implicit group for all logged-in accounts $wgGroupPermissions['user' ]['move']           = false; $wgGroupPermissions['user' ]['read']           = true; $wgGroupPermissions['user' ]['edit']           = false; $wgGroupPermissions['user' ]['createpage']     = false; $wgGroupPermissions['user' ]['createtalk']     = false; $wgGroupPermissions['user' ]['upload']         = false; $wgGroupPermissions['user' ]['reupload']       = false; $wgGroupPermissions['user' ]['reupload-shared'] = false; $wgGroupPermissions['user' ]['minoredit']      = false;

$wgGroupPermissions['studenteditor']['edit'] = true;

$wgGroupPermissions['enrichment']['read'] = true; $wgGroupPermissions['enrichment']['edit'] = true; $wgGroupPermissions['enrichment' ]['createpage']     = true; $wgGroupPermissions['enrichment' ]['upload']         = true; $wgExtraNamespaces = array(100 => "Enrichment_Week",                          101 => "Enrichment_Week_talk"                           );

$wgGroupPermissions['root']['editroot'] = true;

$wgNamespaceProtection[NS_MAIN]    = $wgNamespaceProtection[NS_USER]  = $wgNamespaceProtection[NS_PROJECT] = $wgNamespaceProtection[NS_IMAGE] = $wgNamespaceProtection[NS_TEMPLATE] = $wgNamespaceProtection[NS_HELP] = $wgNamespaceProtection[NS_CATEGORY] = array( 'editroot' );

$wgGroupPermissions['enrichment']['editenrichment'] = true; $wgNamespaceProtection[ 100 ] = array( 'editenrichment' ); --ColinM 19:13, 18 August 2007 (UTC)

Applying wgNamespaceProtection to anon accounts
Is there a way to apply different permissions to anon users based on namespace? For example to prevent anon users from viewing the NS_TALK namespace unless logged in. --Rob 00:00, 3 October 2007 (UTC)