[Mediawiki-l] how to prevent edit and creating pages to "users" group for a custom additional namespace ?

Stip stipen.treublatt at gmx.net
Fri Mar 23 18:03:43 UTC 2012


Am 21.03.2012 18:03, schrieb HiddenId:
> Hi everybody.
> We'd like to create a "Contrib" namespace which will be the only namespace where users of "user group" will be allowed to edit or create pages.
> We've tried the following, but as a result, when we connect to the wiki as a "user", and when we type Contrib:bobopage in search box, we don't have access to create nor edit this page, even it is located inside Contrib. What did we wrong ? (the namespace is present in box/menu resulting from search, with all others namespaces)
>
> Ac
>
> ---------------------- here bellow the code inside LocalSettings.php  ---------------------------
>
> # Add CUSTOM namespaces and regulate access to
> ## Add "Contrib" namespace
> $wgExtraNamespaces[500] = "Contrib"; # creation of namespace at 500 indice
> $wgExtraNamespaces[501] = "Contrib_talk"; # creation of talk namespace at 500 + 1 = 501 indice
> define("NS_CONTRIB", 500); # define a constant for the namespace
> define("NS_CONTRIB_TALK", 501); # define a constant for the talk namespace
> $wgExtraNamespaces[NS_CONTRIB] = "Contrib";
> $wgExtraNamespaces[NS_CONTRIB_TALK] = "Contrib_talk";
> $wgContentNamespaces[] = 500; # make the namespace content taken in account by statistics tools
> ## access to "Contrib" namespace
> # block / allow access to custom namespaces defined
> $wgGroupPermissions['user']['edit'] = false; # forbid access to users
> $wgGroupPermissions['user']['editcontrib'] = true; # give rights to be "editcontrib" to users
> $wgNamespaceProtection[NS_CONTRIB] = array( 'editcontrib' ); # give rights to "editcontrib" rights owners
>
you cant deny the edit-right, cause without it, you cant edit anything.
If you want normal user just to be able to edit CONTRIB and 
CONTRIB_TALK, you will have to protect every other namespace like this:

$wgNamespaceProtection[NS_MAIN] = array( 'edit-main' );
$wgNamespaceProtection[NS_TALK] = array( 'edit-main' );
and so on.

And then you have to give the "edit-main"-right to every group that 
should be able to edit those namespaces:

$wgGroupPermissions['sysop']['edit-main'] = true;
and so on


also, your definition of those custom namespaces is redundant. Just use 
this:

define("NS_CONTRIB", 500); # define a constant for the namespace
define("NS_CONTRIB_TALK", 501); # define a constant for the talk namespace
$wgExtraNamespaces[NS_CONTRIB] = "Contrib";
$wgExtraNamespaces[NS_CONTRIB_TALK] = "Contrib_talk";
$wgContentNamespaces[] = 500; # make the namespace content taken in account by statistics tools

Hope that helps.
Greetings and good luck
stip




More information about the MediaWiki-l mailing list