Last modified: 2014-04-05 18:30:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44171, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42171 - Enable a gadget by default, but only for logged-in users (not for anons)
Enable a gadget by default, but only for logged-in users (not for anons)
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Gadgets (Other open bugs)
master
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-15 23:19 UTC by Lupo
Modified: 2014-04-05 18:30 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Lupo 2012-11-15 23:19:02 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?
Comment 1 Krinkle 2012-11-15 23:23:21 UTC
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?
Comment 2 Lupo 2012-11-16 06:51:30 UTC
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.
Comment 3 Max Semenik 2013-05-02 19:41:02 UTC
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.
Comment 4 Rainer Rillke @commons.wikimedia 2013-06-12 22:05:08 UTC
(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.
Comment 5 Lupo 2013-06-13 18:47:39 UTC
(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.
Comment 6 sen 2013-11-30 16:03:50 UTC
it's not work for me too,only login-user can have it

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links