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

Restrict specific namespace
I would like to restrict the edition of one namespace. The main reason would be to create a new namespace labeled News and a corresponding group Journalists, then I would like to give them those permissions, but I do not want to give them the sysop range or the editinterface capability to change any Namespace a part of the dedicated for them.

I would like to do this without extensions, it is only one group and one specific namespace. Any suggestion?

Wiki info

 * MediaWiki version: 1.14.0
 * Semantic MediaWiki version: 1.4.2
 * PHP version: 5.2.5 (cgi)
 * MySQL version: 4.1.22-standard
 * URL: http://wikimanga.net
 * Direct link to Version

=2009=

Custom Namespace permissions
I have a custom namespace that i have been working on and i need to be able to have SysOps, Bureaucrats, and Developers (my group) to have access to the pages but not '*' or 'users'.

Above, is my setup of the namespaces. NS_SOURCE (100) is the custom namespace i am working on for highly modified pieces of information before it goes to either the NS_PROJECT or NS_MAIN namespaces.

Here is my permissions implmenetation for the sysop and bureau user groups Goldbishop 02:03, 3 July 2009 (UTC)

prevent custom namespace from reading
How do I prevent a custom namespace from reading exectp a trusted usergroup? On Mediawiki 1.18.0 on Windows, when I do define('NS_TWUTZ', 100); $wgExtraNamespaces[NS_TWUTZ] = "twutz"; $wgExtraNamespaces[NS_TWUTZ+1] = "twutz_talk"; $wgContentNamespaces[] = NS_TWUTZ;

$wgNamespaceProtection[NS_TWUTZ] = array( 'edittwutz' ); $wgGroupPermissions[*]['ns100_read']            = false; $wgGroupPermissions['trusted']['ns100_read']    = true; $wgGroupPermissions['sysop']['ns100_read']      = true; Requesting a page in this namespace returns an empty page, also as a sysop.

With the Extension:NamespaceProtection, this was possible. However, this extension is not supported any more, and I get errors on using it together with SemantikMediaWiki. Tomaschwutz 22:03, 17 January 2012 (UTC)