merging latest master
[lhc/web/wiklou.git] / includes / api / ApiQueryUsers.php
index 83872a5..855e270 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on July 30, 2007
  *
- * Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@gmail.com
+ * Copyright © 2007 Roan Kattouw "<Firstname>.<Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -253,14 +253,16 @@ class ApiQueryUsers extends ApiQueryBase {
        * @return array
        */
        public static function getAutoGroups( $user ) {
+               // FIXME this logic is duplicated from User::getEffectiveGroups(), centralize this
                $groups = array();
                $groups[] = '*';
 
                if ( !$user->isAnon() ) {
                        $groups[] = 'user';
+                       $groups = array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) );
                }
 
-               return array_merge( $groups, Autopromote::getAutopromoteGroups( $user ) );
+               return $groups;
        }
 
        public function getCacheMode( $params ) {
@@ -315,6 +317,73 @@ class ApiQueryUsers extends ApiQueryBase {
                );
        }
 
+       public function getResultProperties() {
+               $props = array(
+                       '' => array(
+                               'userid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'name' => 'string',
+                               'invalid' => 'boolean',
+                               'hidden' => 'boolean',
+                               'interwiki' => 'boolean',
+                               'missing' => 'boolean'
+                       ),
+                       'editcount' => array(
+                               'editcount' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'registration' => array(
+                               'registration' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'blockinfo' => array(
+                               'blockid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedby' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedbyid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedreason' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'blockedexpiry' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       ),
+                       'emailable' => array(
+                               'emailable' => 'boolean'
+                       ),
+                       'gender' => array(
+                               'gender' => array(
+                                       ApiBase::PROP_TYPE => array(
+                                               'male',
+                                               'female',
+                                               'unknown'
+                                       ),
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+
+               self::addTokenProperties( $props, $this->getTokenFunctions() );
+
+               return $props;
+       }
+
        public function getDescription() {
                return 'Get information about a list of users';
        }