-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
asselarain-mediawikil(a)yahoo.com wrote:
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:
Use the following code instead:
# Set group edit restrictions
$wgGroupPermissions['*']['editpage'] = false;
$wgGroupPermissions['user']['editpage'] = true;
$wgGroupPermissions['*']['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' ) ) {
$result = false;
} else {
$result = true;
}
}
(I found a few errors in the code I posted earlier, however now the code is
tested and working also in 1.7.1.)
// 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;
You have to use the permissions "editpage" and "edittalk" instead of
"edit" and
"talk", else it doesn't work.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mandriva -
http://enigmail.mozdev.org
iD8DBQFFCq2JqahN/0dU8mcRAkhHAJ0cl9+0OCj42WiDNbsSv/l1d5UjLQCgwkWg
tX10TpiKxdUaq5cGB4NBLNs=
=guap
-----END PGP SIGNATURE-----