2 * @class mw.Api.plugin.user
7 $.extend( mw.Api.prototype, {
10 * Get the current user's groups and rights.
12 * @return {jQuery.Promise}
13 * @return {Function} return.done
14 * @return {Object} return.done.userInfo
15 * @return {string[]} return.done.userInfo.groups User groups that the current user belongs to
16 * @return {string[]} return.done.userInfo.rights Current user's rights
18 getUserInfo: function () {
22 uiprop: [ 'groups', 'rights' ]
23 } ).then( function ( data ) {
24 if ( data.query && data.query.userinfo ) {
25 return data.query.userinfo;
27 return $.Deferred().reject().promise();
34 * @mixins mw.Api.plugin.user
37 }( mediaWiki, jQuery ) );