By default, editing NS_MEDIAWIKI requires "editinterface" permission, just as before.
feature, which automagically disallows edits to pages transcluded into a page protected with
this new option. Various other code tidiness fixes and refactoring in the log messages of
branches/werdna/restrictions-separation.
+* The minimum permissions needed to edit a page in each namespace can
+ now be customized via the $wgNamespaceProtection array. By default,
+ editing pages in the MediaWiki namespace requires "editinterface"
+ permissions, just as before.
== Languages updated ==
+* Finnish (fi)
* Hebrew (he)
* Indonesian (id)
* Lithuanian (lt)
$wgGroupPermissions['sysop']['importupload'] = true;
$wgGroupPermissions['sysop']['move'] = true;
$wgGroupPermissions['sysop']['patrol'] = true;
-$wgGroupPermissions['sysop']['autopatrol'] = true;
+$wgGroupPermissions['sysop']['autopatrol'] = true;
$wgGroupPermissions['sysop']['protect'] = true;
$wgGroupPermissions['sysop']['proxyunbannable'] = true;
$wgGroupPermissions['sysop']['rollback'] = true;
*/
$wgRestrictionLevels = array( '', 'autoconfirmed', 'sysop' );
+/**
+ * Set the minimum permissions required to edit pages in each
+ * namespace. If you list more than one permission, a user must
+ * have all of them to edit pages in that namespace.
+ */
+$wgNamespaceProtection = array();
+$wgNamespaceProtection[ NS_MEDIAWIKI ] = array( 'editinterface' );
+
/**
* Number of seconds an account is required to age before
$fname = 'Title::userCan';
wfProfileIn( $fname );
- global $wgUser;
+ global $wgUser, $wgNamespaceProtection;
$result = null;
wfRunHooks( 'userCan', array( &$this, &$wgUser, $action, &$result ) );
wfProfileOut( $fname );
return false;
}
- // XXX: This is the code that prevents unprotecting a page in NS_MEDIAWIKI
- // from taking effect -ævar
- if( NS_MEDIAWIKI == $this->mNamespace &&
- !$wgUser->isAllowed('editinterface') ) {
- wfProfileOut( $fname );
- return false;
+ if ( array_key_exists( $this->mNamespace, $wgNamespaceProtection ) ) {
+ $nsProt = $wgNamespaceProtection[ $this->mNamespace ];
+ if ( !is_array($nsProt) ) $nsProt = array($nsProt);
+ foreach( $nsProt as $right ) {
+ if( '' != $right && !$wgUser->isAllowed( $right ) ) {
+ wfProfileOut( $fname );
+ return false;
+ }
+ }
}
if( $this->mDbkeyform == '_' ) {