API:User group membership/zh

POST請求以從用戶組增加或移除用戶，從而授予或移除某些用戶權限.



-{zh-hans:示例; zh-hant:範例;}-
要使用此API，您首先需要登入以驗證您自己的用戶組成員. 只有某些用戶組能透過此API更改用戶權限. 參見以獲得有關登入的更多細節.

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. 查詢如下所示：

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.



回应


示例代码


可能的错误


参数历史

 * v1.29: 启用
 * v1.23: 啟用



附加提醒

 * 預設只有行政員用戶組中的用戶才能授予或移除用戶權限.
 * 有些wiki允許非行政員在有限的基礎上授予或移除權限，例如將這些權限限制在用戶自己的帳戶上.
 * 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.