Last modified: 2014-04-05 18:30:18 UTC
How to do this? I don't see any user *rights* that would allow me to reliably distinguish anons from logged-in users. My current work-around is to default-enable the gadget, and then check in the JavaScript for wgUserName: if it's null, the user is not logged in, and the script does nothing. But that's ugly because the script is loaded. If there were a "marker" user right for each user *group*, I could use that. I notice that DefaultSettings.php has $wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true; $wgGroupPermissions['bot']['bot'] = true; Could we add to that $wgGroupPermissions['user']['user'] = true; so that a Gadget could be default-enabled for all logged-in users, but not for anons, using MyGadget[ResourceLoader|default|rights=user]|MyGadget.js in MediaWiki:Gadgets-definition?
Another popular work-around is rights=purge, since that is a simple right that all users have. However the better question is, why would you want to enable a gadget that doesn't rely on any specific user right and yet should be enabled by default for registered users?
The purge right might work... if it isn't to false for normal users. Many of these rights are overridden in the global config files. In any case, using purge is obscure and doesn't express the real criterion. It'd be akin to testing for browser version instead of doing a feature test in JavaScript. Default-enabling a gadget only for logged-in users but not for non-logged-in users is a legitimate use case.
Per-group gadgets aren't in line with MediaWiki's access control model which is right- not group-based. That is, if your gadget is related to editing, make it require edit rights. If it's related to countervandalism, require rollback and so on.
(In reply to comment #3) > Per-group gadgets aren't in line with MediaWiki's access control model Then, this model deserves to be reconsidered. User groups like OTRS members or image reviewers (which is a totally valid use of user groups) may need their own toolset but may not require additional rights. Also, it is known that vandalism by anonymous users is usually harder to fight than misuse of a tool by logged-in users.
(In reply to comment #3) > Per-group gadgets aren't in line with MediaWiki's access control model which > is right- not group-based. That is, if your gadget is related to editing, make > it require edit rights. If it's related to countervandalism, require rollback > and so on. Then that model has already been subverted by the autoconfirmed and bot "rights", which are clearly "marker rights" introduced as work-arounds for there not being group-based access control. It would be easy and logical to add to that a "user" marker right. In the precise case, it's a gadget that makes certain editing operations easier, but people don't want to enable it for non-logged-in users (because of vandalism concerns). Strikes me as completely legitimate. But rights=edit doesn't fit the bill, that would enable the gadget for all users. We can (and *do*) work-around this limitation by using the "purge" right as suggested by Krinkle, but that's a hack.
it's not work for me too,only login-user can have it