Working With MediaWiki
true;
Creating new groups
And how do you add a new group? That’s actually very simple: as soon as a group is referred to in LocalSettings.php, within a “$wgGroupPermissions” call, it gets defined within the system if it wasn’t defined already. So, for instance, suppose you want to create a new user group, “blocker”, whose only special rights are the ability to block and unblock users. You would just have to add the following to LocalSettings.php:
$wgGroupPermissions['blocker']['block'] = true;
When they’re first created, new groups don’t have any members. So, once you created the “blocker” group, you would presumably use the page Special:UserRights to start adding users to that group.
Common permissions settings
In addition to specific group names, you can use the value ’*’ to refer to everyone, including non-logged-in users, if the wiki has them. This comes in handy when removing rights that by default are available to everyone.So if you want to make editing of pages available only to logged-in users (a common setting), you can just add the following two lines:
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = true;
Similarly, todisallow viewing of the site by anyone not logged in, you would add:
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['user']['read'] = true;
Another somewhat-common setting is to turn off user registration on the wiki, so that only administrators can add new users. This is again accomplished with just two lines:
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['sysop']['createaccount'] = true;
There are actually dozens of settable MediaWiki permissions, defined within both core MediaWiki and many of its extensions. Some of these are covered in this book, but a complete list of all MediaWiki permissions can be found at:
https://www.mediawiki.org/wiki/Manual:User_rights
Restricting the viewing and editing of specific pages or sections in the wiki is covered here .
Blocking users
Administrators can block other users from editing, which is extremely useful when dealing with spammers, vandals, and (to a more limited extent) people who make too many poor edits. Blocking is governed by the ’block’ permission.
Blocking is done at the page Special:Block, which you can go to directly, although for administrators it’s also linked to from each row in both the RecentChanges page and in history pages.
Figure 8.5 shows the interface viewable at Special:Block.
Figure 8.5 Special:Block page
You can specify either a username or an IP address to block; if the user in question is making edits without being logged in, then you will of course have to specify their IP address. In reality, it shouldn’t matter which you do, as long as you keep the “Automatically block the last IP address used by this user...” checkbox checked (which you should, assuming that this is a true malicious user and not just someone that you temporarily want to send a message to).
The checkbox defaults are generally good; however, it’s usually a good idea to check the last checkbox as well, “Prevent logged-in users from editing from this IP address”. Spammers can sometimes register hundreds of accounts, then wait until months or even years later to attack with them. If you select that checkbox, all those accounts could potentially be neutralized, which would be a big win.
Sometimes, spammers and malicious users can use a whole range of IP addresses, such as any address that starts with “123.45”, or “123.45.67”. (Even if they’re always logged in when making edits, you can still find out their IP address if you’re an administrator — see here .) If that’s the case, blocking individual IP addresses will probably be ineffectual. Thankfully, the Block page also lets you block an entire range of IP addresses, which can end up being a real lifesaver. To do that, you can simply specify a range instead of a single IP address in the “IP address or username” field. For the first example, you could enter “123.45.0.0 — 123.45.255.255”.
For what it’s worth, there’s a whole syntax you can use for IP range blocks, beyond the simple “a — b” formulation — it’s all described here:
https://www.mediawiki.org/wiki/Help:Range_blocks
The “Expiry” field dictates how long the user will be blocked for — this can always be changed later. With spammers and egregious vandals, the best approach is to
Weitere Kostenlose Bücher