|
Ludo ( Marc Alier) made changes - 26/Jun/08 04:05 PM
This is a general problem that we will find in all the API.
Shall we have just one funcion with complex parameters or do we want a looong list of functions. Anyway : Maintenance is the issue. IMO we should have only one function to do the actual work (so it can be modified when needed): The currently implemented delete_user(id) or similar. The we can have a set of functions (or just one with complex parameters) that using this one allows more functionality. Insigths? Hi David, hi ludo,
I read the specification (http://docs.moodle.org/en/Development:Web_services According to current spec: The function receives and array with
– idnumber or email or id or login – OK; NOW how do I know WHAT IS a value in the array ? This is the question... Hi,
We think that the easiest way to solve this functionality is deleting only by id or idnumber, because all of them are unique on Moodle. Some more PHPDoc from spec
/**
/**
I've just added in the CVS the add_user function working with an associative array as it's suggested. It can be find here:
http://cvs.moodle.org/contrib/patches/dfws/webservice/apis/user.lib.php?revision=1.4&view=markup The name of the function is: array mdl_user_delete_instances($userids, $idtype='idnumber') The particles of the name are explained here: http://tracker.moodle.org/browse/MDL-13126?focusedCommentId=56209#action_56209 The function gets one mandatory param and am optional one, and returns an associative array of identifier=>boolean. The hot point of this function is that users can be identified by several fields: -username So, to implement this function we decided to allow all of them. The default is 'idnumber' but, you can pass an array of internal ids, usernames or emails too, just by specify it in the second parameter. As Martin wants (and Pigui remember me), in delete_users the first param will be a criteria and the second an array of users. This makes default value impossible, but it's may be more polite. New code can be found threre:
http://cvs.moodle.org/contrib/patches/dfws/webservice/apis/user.lib.php?revision=1.5&view=markup
David Castro made changes - 08/Oct/08 12:29 AM
Implemented and finished on CVS.
David Castro made changes - 10/Oct/08 01:40 AM
Ludo ( Marc Alier) made changes - 06/Nov/08 07:26 PM
Jerome Mouneyrac made changes - 11/Nov/09 11:05 AM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If we want delete some users by different criteria, we could do some functions like delete_users_by_id, delete_users_by_idnumber, delete_users_by_email, etc.
Or do it in a function delete_users ($array, $criteria);
where $criteria is a string {id, idnumber or email}
and $array is the array with values for specified criteria.