Manual talk:$wgNamespaceProtection

=2007=

prevent editing of a custom namespace
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? --18 May 2007


 * 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' ); --C.mackinlay 2 June 2007

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)


 * probably a misunderstanding? It seems that 'studenteditor' cannot edit the 'Enrichment_Week' (code 100) namespace because in the last line is protected ('editenrichment' permission is required and this permission is given to 'enrichment' group and not to 'studenteditor'). I missed something? TKS --GB 12:02, 8 November 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)

Group name problems
FYI: the database that came with 1.10 is has a group name limitation of 16 characters by default. This is easily changed with your favorite mysql editor but since it truncates the names to fit it can be a gotcha.

This also effects group names that are sync'd in from LDAP/AD as mediawiki will mirror their names into it's database.

--Jacob, Oct 24, 2007