Page MenuHomePhabricator

User groups should be exposed to Scribunto
Open, LowPublic

Description

Scribunto should have an interface to get the groups a user is in. Example:

if mw.user.new(frame.args[1]).groups.sysop then
 return 'Admin'
else
 return 'User'
end

This was requested on https://en.wikipedia.org/w/index.php?oldid=639931577#Simpler_process_for_submitting_a_request_for_arbitration

Event Timeline

Jackmcbarn raised the priority of this task from to Low.
Jackmcbarn updated the task description. (Show Details)
Jackmcbarn added a project: Scribunto.
Jackmcbarn subscribed.

Note that any way to get the "current" user (or any data about the "current" user) would be a no-go, as it would break caching horribly. But access to publicly-accessibly data about a user (i.e. what's available from the API list=users) by name doesn't a priori seem like a problem.

gerritbot subscribed.

Change 188503 had a related patch set uploaded (by Jackmcbarn):
Expose user information to Lua

https://gerrit.wikimedia.org/r/188503

Patch-For-Review

A related bug ask also the user language code. An english admin could then better help any other little wiki.
https://phabricator.wikimedia.org/T68051
examples : https://fr.wikisource.org/wiki/Module:ControlArgs#Multilingual_examples._Exemples_multilingues

Rical renamed this task from User groups should be exposed to Scribunto to Expose users groups to modules to better adapt their displays to readers or supporters.May 21 2016, 12:18 PM
Rical updated the task description. (Show Details)
Jackmcbarn renamed this task from Expose users groups to modules to better adapt their displays to readers or supporters to User groups should be exposed to Scribunto.May 22 2016, 3:05 AM
Jackmcbarn updated the task description. (Show Details)

Rical, please don't do that.

An obvious use case for this is – Each time a flag is granted or revoked, people on every project manually update all relevant Project namespace pages and templates. All this should be updated automatically from a single source of truth.

Just think of the amount of effort that will be saved!