Merge "selenium: invoke jobs to enforce eventual consistency"
[lhc/web/wiklou.git] / resources / src / mediawiki.api / user.js
1 /**
2 * @class mw.Api.plugin.user
3 * @since 1.27
4 */
5 ( function () {
6
7 $.extend( mw.Api.prototype, {
8
9 /**
10 * Get the current user's groups and rights.
11 *
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
17 */
18 getUserInfo: function () {
19 return this.get( {
20 action: 'query',
21 meta: 'userinfo',
22 uiprop: [ 'groups', 'rights' ]
23 } ).then( function ( data ) {
24 if ( data.query && data.query.userinfo ) {
25 return data.query.userinfo;
26 }
27 return $.Deferred().reject().promise();
28 } );
29 }
30 } );
31
32 /**
33 * @class mw.Api
34 * @mixins mw.Api.plugin.user
35 */
36
37 }() );