From 4445af121701cedb3e9050b43ae2f769ddc0e01d Mon Sep 17 00:00:00 2001 From: mistic100 Date: Thu, 24 Oct 2013 16:21:24 +0000 Subject: feature 2976: can change user status and level fix saving problem of groups.is_default value use WS_PARAM_OPTIONAL when possible (TODO: use for old methods) git-svn-id: http://piwigo.org/svn/trunk@25118 68402e56-0260-453c-a942-63ccdbb3a9ee --- ws.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'ws.php') diff --git a/ws.php b/ws.php index 01b2ecf02..2ae44a5bf 100644 --- a/ws.php +++ b/ws.php @@ -707,10 +707,9 @@ function ws_addDefaultMethods( $arr ) 'pwg.groups.getList', 'ws_groups_getList', array( - 'group_id' => array('default'=>null, - 'flags'=>WS_PARAM_FORCE_ARRAY, + 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_ID), - 'name' => array('default'=>null, + 'name' => array('flags'=>WS_PARAM_OPTIONAL, 'info'=>'Use "%" as wildcard.'), 'per_page' => array('default'=>100, 'maxValue'=>$conf['ws_max_users_per_page'], @@ -755,8 +754,8 @@ function ws_addDefaultMethods( $arr ) 'ws_groups_setInfo', array( 'group_id' => array('type'=>WS_TYPE_ID), - 'name' => array('default'=>null), - 'is_default' => array('default'=>null, + 'name' => array('flags'=>WS_PARAM_OPTIONAL), + 'is_default' => array('flags'=>WS_PARAM_OPTIONAL, 'type'=>WS_TYPE_BOOL), ), 'Admin & POST only. Updates a group. Leave a field blank to keep the current value.', @@ -794,19 +793,16 @@ function ws_addDefaultMethods( $arr ) 'pwg.users.getList', 'ws_users_getList', array( - 'user_id' => array('default'=>null, - 'flags'=>WS_PARAM_FORCE_ARRAY, + 'user_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_ID), - 'username' => array('default'=>null, + 'username' => array('flags'=>WS_PARAM_OPTIONAL, 'info'=>'Use "%" as wildcard.'), - 'status' => array('default'=>null, - 'flags'=>WS_PARAM_FORCE_ARRAY, + 'status' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'info'=>'guest,generic,normal,admin,webmaster'), 'min_level' => array('default'=>0, 'maxValue'=>max($conf['available_permission_levels']), 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), - 'group_id' => array('default'=>null, - 'flags'=>WS_PARAM_FORCE_ARRAY, + 'group_id' => array('flags'=>WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY, 'type'=>WS_TYPE_ID), 'per_page' => array('default'=>100, 'maxValue'=>$conf['ws_max_users_per_page'], @@ -851,9 +847,14 @@ function ws_addDefaultMethods( $arr ) 'ws_users_setInfo', array( 'user_id' => array('type'=>WS_TYPE_ID), - 'username' => array('default'=>null), - 'password' => array('default'=>null), - 'email' => array('default'=>null), + 'username' => array('flags'=>WS_PARAM_OPTIONAL), + 'password' => array('flags'=>WS_PARAM_OPTIONAL), + 'email' => array('flags'=>WS_PARAM_OPTIONAL), + 'status' => array('flags'=>WS_PARAM_OPTIONAL, + 'info'=>'generic,normal,admin'), + 'level'=> array('flags'=>WS_PARAM_OPTIONAL, + 'maxValue'=>max($conf['available_permission_levels']), + 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), ), 'Admin & POST only. Updates a user. Leave a field blank to keep the current value.', null, -- cgit v1.2.3