Page MenuHomePhabricator

Expose user groups as JavaScript variable
Closed, ResolvedPublic


Sometimes you want to have scripts funtion slightly different if you are admin
or not, and it's sometimes rather diffcult to do that. So I propose that a
variable is added, for example "wgUserGroup", that contain the usergroup(s). the
only problem is that if it only should have the "highest" group, or if it should
contain an array of all groups, for example:

wgUserGroups = [ 'autoconfirmed' , 'sysop' ];

Version: unspecified
Severity: enhancement



Related Objects


Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:35 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz8712.
bzimport added a subscriber: Unknown Object (MLST).

Patch implementing the functionallity

Have made an simple patch that will implement the wanted feature

attachment wgUserGroups.patch ignored as obsolete

robchur wrote:

Applied in r19524.

updated patch

seems like User::getGroups() don't reply with all we want, so I have changed it
to User::getEffectiveGroups();