Manual:Hooks/UserGetImplicitGroups

From Linux Web Expert

UserGetImplicitGroups
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 465784)</tvar></translate>
Dynamically adds to or removes from the list of available groups.
<translate> Define function:</translate>
public static function onUserGetImplicitGroups( &$aGroups ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserGetImplicitGroups": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserGetImplicitGroups"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> User.php
<translate> Interface:</translate> UserGetImplicitGroupsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UserGetImplicitGroups extensions</tvar>.</translate>


Use cases

This hook may be used as part of an extension that synchronizes the list of available groups with external applications or the host operating system.

Implementation background

MediaWiki supports the assignment of group-based user rights. The list of available groups is defined by three sources: groups hard coded into MediaWiki (*, user, autoconfirmed, emailconfirmed), the keys of the $wgGroupPermissions configuration variable and the groups added or filtered by this hook.

Usage

Implementers return a list of groups that should be added. The source for the list may be a hard coded list, a file, a database table, a third party application, or anything else a programmer's imagination can dream up.