[Mediawiki-l] Users can not 'talk'

Rotem Liss rotemliss_net at fastmail.fm
Thu Sep 14 17:25:20 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexis Moinet wrote:
> asselarain-mediawikil-/E1597aS9LQAvxtiuMwx3w at public.gmane.org a écrit :
>> Hm...doesn't these two lines mean that "Users (logged in or not) can't edit PAGES"? I want that to be like that -- users should not edit pages since this is a web page, but they should be able to participate by contributing to 'talk' pages. 
>>
> 
> I think the 'talk' right doesn't exist in mediawiki default installation, you need to create it by changing a little bit the *isAllowed()* function in "includes/User.php " folder.
> 

You should not handle the talk pages editing in User::isAllowed ? it's a general
function for *all* the permissions, and editing talk pages is not a "special
case"! The right way would be to add the restrictions to Title::userCan via the
hook userCan. Something like that in LocalSettings.php may work (I didn't check
it), and will not be removed in upgrades:

# Set group edit restrictions
$wgGroupPermissions['*']['editpage'] = false;
$wgGroupPermissions['user']['editpage'] = true;
$wgGruopPermissions['*']['edittalk'] = true;

# Set userCan hook
$wgHooks['userCan'][] = 'wfSetEditRestrictions';

# Edit restrictions
function wfSetEditRestrictions( &$title, &$user, $action, &$result ) {
    if( $action != 'edit' ) {
        return;
    }
    if( $title->isTalkPage() && !$user->isAllowed( 'edittalk' ) ||
!$title->isTalkPage() && !$user->isAllowed( 'editpage' ) {
        return false;
    } else {
        return true;
    }
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFFCZCAqahN/0dU8mcRAtFGAJ0UvyVq5quX/AehHX6Jsht5KCkNOgCgurYO
LoEbLAbGxAHz4GvsEwrdSIk=
=8ell
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list