- Timestamp:
- Oct 28, 2013, 6:53:36 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r25195 r25196 3449 3449 } 3450 3450 3451 $display = array('u.'.$conf['user_fields']['id'] => 'id'); 3452 3453 if ($params['display'] != 'none') 3454 { 3455 $params['display'] = explode(',', $params['display']); 3456 3457 if (in_array('all', $params['display'])) 3458 { 3459 $params['display'] = array_merge($params['display'], array( 3460 'username','email','status','level','groups','language','theme', 3461 'nb_image_page','recent_period','expand','show_nb_comments','show_nb_hits', 3462 'enabled_high', 3463 )); 3464 } 3465 else if (in_array('basics', $params['display'])) 3466 { 3467 $params['display'] = array_merge($params['display'], array( 3468 'username','email','status','level','groups', 3469 )); 3470 } 3471 3472 if (in_array('username', $params['display'])) 3473 { 3474 $display['u.'.$conf['user_fields']['username']] = 'username'; 3475 } 3476 if (in_array('email', $params['display'])) 3477 { 3478 $display['u.'.$conf['user_fields']['email']] = 'email'; 3479 } 3480 3481 $ui_fields = array( 3482 'status','level','language','theme','nb_image_page','recent_period','expand', 3483 'show_nb_comments','show_nb_hits','enabled_high', 3484 ); 3485 foreach ($ui_fields as $field) 3486 { 3487 if (in_array($field, $params['display'])) 3488 { 3489 $display['ui.'.$field] = $field; 3490 } 3491 } 3492 } 3493 else 3494 { 3495 $params['display'] = array(); 3496 } 3497 3451 3498 $query = ' 3452 SELECT DISTINCT 3453 u.'.$conf['user_fields']['id'].' AS id, 3454 u.'.$conf['user_fields']['username'].' AS username, 3455 u.'.$conf['user_fields']['email'].' AS email, 3456 ui.status, 3457 ui.level, 3458 "" AS groups 3499 SELECT DISTINCT '; 3500 3501 $first = true; 3502 foreach ($display as $field => $name) 3503 { 3504 if (!$first) $query.= ', '; 3505 else $first = false; 3506 $query.= $field .' AS '. $name; 3507 } 3508 if (in_array('groups', $params['display'])) 3509 { 3510 if (!$first) $query.= ', '; 3511 $query.= '"" AS groups'; 3512 } 3513 3514 $query.= ' 3459 3515 FROM '.USERS_TABLE.' AS u 3460 3516 INNER JOIN '.USER_INFOS_TABLE.' AS ui … … 3471 3527 $users = hash_from_query($query, 'id'); 3472 3528 3473 if ( count($users) > 0)3529 if ( count($users) > 0 and in_array('groups', $params['display']) ) 3474 3530 { 3475 3531 $query = ' … … 3619 3675 return new PwgError(403, 'Only webmasters can grant "webmaster" status'); 3620 3676 } 3621 if ( !in_array($params['status'], array('g eneric','normal','admin','webmaster')) )3677 if ( !in_array($params['status'], array('guest','generic','normal','admin','webmaster')) ) 3622 3678 { 3623 3679 return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid status'); … … 3733 3789 } 3734 3790 3735 return $service->invoke('pwg.users.getList', array('user_id' => $params['user_id'])); 3791 return $service->invoke('pwg.users.getList', array( 3792 'user_id' => $params['user_id'], 3793 'display' => 'basics,'.implode(',', array_keys($updates_infos)), 3794 )); 3736 3795 } 3737 3796 -
trunk/ws.php
r25195 r25196 812 812 'order' => array('default'=>'id', 813 813 'info'=>'id, username, level, email'), 814 ), 815 '<b>Admin only.</b> Retrieves a list of all the users.', 814 'display' => array('default'=>'basics', 815 'info'=>'all,basics,none,username,email,status,level,groups,language,theme,nb_image_page,recent_period,expand,show_nb_comments,show_nb_hits,enabled_high'), 816 ), 817 '<b>Admin only.</b> Retrieves a list of all the users. 818 <br>"display" controls which data are returned, "basics" stands for "username,email,status,level,groups"', 816 819 null, 817 820 array('admin_only'=>true) … … 853 856 'email' => array('flags'=>WS_PARAM_OPTIONAL), 854 857 'status' => array('flags'=>WS_PARAM_OPTIONAL, 855 'info'=>'g eneric,normal,admin'),858 'info'=>'guest,generic,normal,admin,webmaster'), 856 859 'level'=> array('flags'=>WS_PARAM_OPTIONAL, 857 860 'maxValue'=>max($conf['available_permission_levels']),
Note: See TracChangeset
for help on using the changeset viewer.