API:User group membership/zh

POST request to add or remove users from a group, thereby granting or removing certain user rights.

The ability to add or remove users from a group is generally restricted to wiki, with some exceptions, described under #Additional notes.

Example
To use this API, you first need to log in to verify your own user group membership. Only certain groups are granted the ability to alter user rights via this API. See for more details on logging in.

The query above applies to MediaWiki v1.24+; in older versions, the  token would depend on the name of the user whose rights were being changed. The query would be made like so:

For compatibility reasons, the API will also accept the token used in the web UI.

Whichever method you choose, once you have your token, you can use it to make your  request, as seen below.

Parameter history

 * v1.23: Introduced

Additional notes

 * By default, only users in the bureaucrat group can grant or remove user rights.
 * Some wikis allow non-bureaucrats to grant or remove rights on a limited basis, such as restricting those abilities to the user's own account.
 * If you do not possess the ability to grant or remove rights to the target user, the API will not throw an error; instead, the  and   fields in the response will simply contain empty arrays.

参见

 * - describes how user rights and group membership work in greater detail.
 * Special:ListGroupRights - lists all the rights and privileges conferred to each user group on a particular wiki.
 * Special:UserRights - a GUI way to add or remove user rights, available in wikis running v1.29+.
 * - gets information about a list of users, including their groups and rights.