Changeset 25474
- Timestamp:
- Nov 13, 2013, 1:58:21 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions/pwg.users.php
r25472 r25474 517 517 } 518 518 519 // manage association to groups 520 if (!empty($params['group_id'])) 521 { 522 $query = ' 523 DELETE 524 FROM '.USER_GROUP_TABLE.' 525 WHERE user_id IN ('.implode(',', $params['user_id']).') 526 ;'; 527 pwg_query($query); 528 529 // we remove all provided groups that do not really exist 530 $query = ' 531 SELECT 532 id 533 FROM '.GROUPS_TABLE.' 534 WHERE id IN ('.implode(',', $params['group_id']).') 535 ;'; 536 $group_ids = array_from_query($query, 'id'); 537 538 // if only -1 (a group id that can't exist) is in the list, then no 539 // group is associated 540 541 if (count($group_ids) > 0) 542 { 543 $inserts = array(); 544 545 foreach ($group_ids as $group_id) 546 { 547 foreach ($params['user_id'] as $user_id) 548 { 549 $inserts[] = array('user_id' => $user_id, 'group_id' => $group_id); 550 } 551 } 552 553 mass_inserts(USER_GROUP_TABLE, array_keys($inserts[0]), $inserts); 554 } 555 } 556 519 557 return $service->invoke('pwg.users.getList', array( 520 558 'user_id' => $params['user_id'], -
trunk/ws.php
r25472 r25474 885 885 'language' => array('flags'=>WS_PARAM_OPTIONAL), 886 886 'theme' => array('flags'=>WS_PARAM_OPTIONAL), 887 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_INT), 887 888 // bellow are parameters removed in a future version 888 889 'nb_image_page' => array('flags'=>WS_PARAM_OPTIONAL, … … 900 901 ), 901 902 'Updates a user. Leave a field blank to keep the current value. 902 <br>"username", "password" and "email" are ignored if "user_id" is an array.', 903 <br>"username", "password" and "email" are ignored if "user_id" is an array. 904 <br>set "group_id" to -1 if you want to dissociate users from all groups', 903 905 $ws_functions_root . 'pwg.users.php', 904 906 array('admin_only'=>true, 'post_only'=>true)
Note: See TracChangeset
for help on using the changeset viewer.