Obviously usercan is a very much better way of handling restrictions compared with custom modifications to User.php (My experience with losing the mods @ upgrade is good evidence).
Sadly, though, usercan seems NOT to work with 1.7.1 ! (I have attached my LocalSettings.php part below:
// No anonymous editing allowed - $wgGroupPermissions['*' ]['read'] = true; $wgGroupPermissions['*' ]['edit'] = false; $wgGroupPermissions['*' ]['talk'] = false; $wgGroupPermissions['user' ]['edit'] = false; $wgGroupPermissions['user' ]['move'] = false; $wgGroupPermissions['user' ]['talk'] = true;
# Edit restrictions function wfSetEditRestrictions( &$title, &$user, $action, &$result ) { if( $action != 'edit' ) { return; } if( ( $title->isTalkPage() && !$user->isAllowed( 'talk' )) || (!$title->isTalkPage() && !$user->isAllowed( 'edit' )) ) { return false; } else { return true; } } # Set userCan hook $wgHooks['userCan'][] = 'wfSetEditRestrictions';
----- Original Message ---- From: Rotem Liss rotemliss_net@fastmail.fm To: MediaWiki announcements and site admin list mediawiki-l@Wikimedia.org Sent: Friday, September 15, 2006 2:25:20 AM Subject: Re: [Mediawiki-l] Users can not 'talk'
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Alexis Moinet wrote:
asselarain-mediawikil-/E1597aS9LQAvxtiuMwx3w@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; } }
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l