Jump to content

Manual:$wgNamespaceProtection: Difference between revisions

From mediawiki.org
Content deleted Content added
Bdk (talk | contribs)
thanks for the update :-)
Add example
Line 17: Line 17:


Since 1.14, the MediaWiki: namespace is unconditionally protected to users with 'editinterface' right (same as in previous versions). This is set in [[Manual:Setup.php|Setup.php]] and cannot be modified in [[Manual:LocalSettings.php|LocalSettings.php]] since otherwise it's too easy to set it incorrectly and leave the wiki insecure.
Since 1.14, the MediaWiki: namespace is unconditionally protected to users with 'editinterface' right (same as in previous versions). This is set in [[Manual:Setup.php|Setup.php]] and cannot be modified in [[Manual:LocalSettings.php|LocalSettings.php]] since otherwise it's too easy to set it incorrectly and leave the wiki insecure.
If you want to allow other groups than sysops to edit the MediaWiki: namespace, then [[Manual:User rights|grant 'editinterface' right]] to those groups.
If you want to allow other groups than sysops to edit the MediaWiki: namespace, then [[Manual:User rights|grant the 'editinterface' right]] to those groups.

== Example ==
<source lang="php">
define("NS_VESSEL", 100);
define("NS_VESSEL_TALK", 101);
define("NS_DOJO", 102);
define("NS_DOJO_TALK", 103);

$wgExtraNamespaces =
array(100 => "Vessel",
101 => "Vessel_talk",
102 => "Dojo",
103 => "Dojo_talk",
);

$wgNamespaceProtection[NS_VESSEL] = array( 'keel-haul' );
$wgNamespaceProtection[NS_VESSEL_TALK] = array( 'plank-walk' );
$wgNamespaceProtection[NS_DOJO] = array( 'sneak' );

$wgGroupPermissions['pirates']['keel-haul'] = true; //only pirates can edit pages in the Vessel namespace
$wgGroupPermissions['landlubbers']['plank-walk'] = true; //only landlubbers can edit pages in the Vessel_talk namespace
$wgGroupPermissions['ninjas']['sneak'] = true; //only ninjas can edit pages in the Dojo namespace
//anyone can edit the Dojo_talk namespace
</source>


== See Also ==
== See Also ==

Revision as of 23:32, 20 April 2009

Namespaces: $wgNamespaceProtection
Which namespaces can be edited by whom?
Introduced in version:1.10.0 (r19110)
Removed in version:Still in use
Allowed values:array of arrays
Default value:$wgNamespaceProtection[NS_MEDIAWIKI] = array( 'editinterface' ); from 1.10 to 1.13
$wgNamespaceProtection = array(); since 1.14

Details

This setting allows a wiki to require special permissions to edit some namespaces. By default, the only restriction is that the MediaWiki namespace can only be edited by users with the 'editinterface' permission (by default: sysops).

The keys of the array are namespace numbers, and the values are simple arrays of permission names. If you list more than one permission for a given namespace, a user must have all of them to edit pages in that namespace.

Since 1.14, the MediaWiki: namespace is unconditionally protected to users with 'editinterface' right (same as in previous versions). This is set in Setup.php and cannot be modified in LocalSettings.php since otherwise it's too easy to set it incorrectly and leave the wiki insecure. If you want to allow other groups than sysops to edit the MediaWiki: namespace, then grant the 'editinterface' right to those groups.

Example

define("NS_VESSEL", 100);
define("NS_VESSEL_TALK", 101);
define("NS_DOJO", 102);
define("NS_DOJO_TALK", 103);

$wgExtraNamespaces = 
    array(100 => "Vessel",
          101 => "Vessel_talk",
          102 => "Dojo",
          103 => "Dojo_talk",
    );

$wgNamespaceProtection[NS_VESSEL]      = array( 'keel-haul' );
$wgNamespaceProtection[NS_VESSEL_TALK] = array( 'plank-walk' );
$wgNamespaceProtection[NS_DOJO]        = array( 'sneak' );

$wgGroupPermissions['pirates']['keel-haul'] = true; //only pirates can edit pages in the Vessel namespace
$wgGroupPermissions['landlubbers']['plank-walk'] = true; //only landlubbers can edit pages in the Vessel_talk namespace
$wgGroupPermissions['ninjas']['sneak'] = true; //only ninjas can edit pages in the Dojo namespace
//anyone can edit the Dojo_talk namespace

See Also