<?php // $Id$
$string['soapdocumentation'] = '<H2>SOAP Manual</H2>
- <b>1.</b> Call the method <b>tmp_get_token</b> on \"<i>http://remotemoodle/webservice/soap/server.php?wsdl</i>\"<br>
+ <b>1.</b> Call the method <b>get_token</b> on \"<i>http://remotemoodle/webservice/soap/server.php?wsdl</i>\"<br>
The function parameter is an array: in PHP it would be array(\"username\" => \"wsuser\", \"password\" => \"wspassword\")<br>
Return value is a token (integer)<br>
<br>
your_client->tmp_delete_user(array(\"username\" => \"username_to_delete\",\"mnethostid\" => 1))<br><br>
';
$string['xmlrpcdocumentation'] = '<H2>XMLRPC Manual</H2>
- <b>1.</b> Call the method <b>authentication.tmp_get_token</b> on \"<i>http://remotemoodle/webservice/xmlrpc/server.php</i>\"<br>
+ <b>1.</b> Call the method <b>authentication.get_token</b> on \"<i>http://remotemoodle/webservice/xmlrpc/server.php</i>\"<br>
The function parameter is an array: in PHP it would be array(\"username\" => \"wsuser\", \"password\" => \"wspassword\")<br>
Return value is a token (integer)<br>
<br>
* @param array|struct $params
* @return integer
*/
- function tmp_get_token($params) {
+ function get_token($params) {
if ($params['username'] == 'wsuser' && $params['password'] == 'wspassword') {
return '456';
} else {
/// TODO: this use a fake token => need to implement token generation
$token = optional_param('token',null,PARAM_ALPHANUM);
if (empty($token)) {
- if ($functionname != 'tmp_get_token') {
+ if ($functionname != 'get_token') {
throw new moodle_exception('identifyfirst');
} else {
/// TODO: authentication + token generation need to be implemented
if ($groupid && $userid) {
- var_dump($CFG->serverurl.'/group/tmp_add_groupmember');
+ var_dump($CFG->serverurl.'/group/add_groupmember');
//we are asking for a token
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['userid'] = $userid;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/tmp_add_groupmember');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/add_groupmember');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
if ($groupname && $courseid) {
- var_dump($CFG->serverurl.'/group/tmp_create_group');
+ var_dump($CFG->serverurl.'/group/create_group');
//we are asking for a token
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['courseid'] = $courseid;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/tmp_create_group');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/create_group');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$token = curl_exec($ch);
$data['token'] = $token;
-curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_create_user');
+curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/create_user');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/tmp_delete_group');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/delete_group');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
if ($groupid && $userid) {
- var_dump($CFG->serverurl.'/group/tmp_delete_groupmember');
+ var_dump($CFG->serverurl.'/group/delete_groupmember');
//we are asking for a token
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['userid'] = $userid;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/tmp_delete_groupmember');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/delete_groupmember');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['mnethostid'] = $mnethostid;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_delete_user');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/delete_user');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['groupid'] = $groupid;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/tmp_get_group');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/group/get_group');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['token'] = $token;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_users');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_users');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
$connectiondata['username'] = 'wsuser';
$connectiondata['password'] = 'wspassword';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/get_token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($connectiondata));
$data['firstname'] = $firstname;
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_update_user');
+ curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/update_user');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, format_postdata($data));
//1. authentication
$client = new Zend_Soap_Client($CFG->wwwroot."/webservice/soap/server.php?wsdl");
try {
- $token = $client->tmp_get_token(array('username' => "wsuser", 'password' => "wspassword"));
+ $token = $client->get_token(array('username' => "wsuser", 'password' => "wspassword"));
print "<pre>\n";
var_dump($token);
print "</pre>";
$client = new Zend_Soap_Client($CFG->wwwroot."/webservice/soap/server.php?token=".$token."&classpath=user&wsdl");
var_dump($CFG->wwwroot."/webservice/soap/server.php?token=".$token."&classpath=user&wsdl");
print "<pre>\n";
-var_dump($client->tmp_get_users(array('search' => "admin")));
+var_dump($client->get_users(array('search' => "admin")));
print "</pre>";
//$param = array('search' => "admin");
//call_soap_function($client,$functionname,$param,$expectedresult);
print "<pre>\n";
-var_dump($client->tmp_create_users(array(array('username' => "mockuser66",'firstname' => "firstname6",'lastname' => "lastname6",'email' => "mockuser6@mockuser6.com",'password' => "password6"))));
+var_dump($client->create_users(array(array('username' => "mockuser66",'firstname' => "firstname6",'lastname' => "lastname6",'email' => "mockuser6@mockuser6.com",'password' => "password6"))));
print "</pre>";
print "<pre>\n";
-var_dump($client->tmp_update_users(array(array('username' => "mockuser66",'newusername' => "mockuser6b",'firstname' => "firstname6b"))));
+var_dump($client->update_users(array(array('username' => "mockuser66",'newusername' => "mockuser6b",'firstname' => "firstname6b"))));
print "</pre>";
print "<pre>\n";
-var_dump($client->tmp_delete_users(array(array('username' => "mockuser6b"))));
+var_dump($client->delete_users(array(array('username' => "mockuser6b"))));
print "</pre>";
//print "<pre>\n";
//1. authentication
$client = new Zend_XmlRpc_Client($CFG->wwwroot."/webservice/xmlrpc/server.php");
-$token = $client->call('authentication.tmp_get_token', array(array('username' => "wsuser", 'password' => "wspassword")));
+$token = $client->call('authentication.get_token', array(array('username' => "wsuser", 'password' => "wspassword")));
var_dump($token);
//2. test functions
$client = new Zend_XmlRpc_Client($CFG->wwwroot."/webservice/xmlrpc/server.php?classpath=user&token=".$token);
-var_dump($users = $client->call('user.tmp_get_users', array(array('search' => "admin"))));
+var_dump($users = $client->call('user.get_users', array(array('search' => "admin"))));
print "<br/><br/>\n";
-var_dump($users = $client->call('user.tmp_create_users', array(array(array('firstname' => "firstname6",'username' => "mockuser66",'lastname' => "lastname6",'email' => "mockuser6@mockuser6.com",'password' => "password6")))));
+var_dump($users = $client->call('user.create_users', array(array(array('firstname' => "firstname6",'username' => "mockuser66",'lastname' => "lastname6",'email' => "mockuser6@mockuser6.com",'password' => "password6")))));
print "<br/><br/>\n";
-var_dump($users = $client->call('user.tmp_update_users', array(array(array('username' => "mockuser66",'newusername' => "mockuser6b",'firstname' => "firstname6b")))));
+var_dump($users = $client->call('user.update_users', array(array(array('username' => "mockuser66",'newusername' => "mockuser6b",'firstname' => "firstname6b")))));
print "<br/><br/>\n";
-var_dump($users = $client->call('user.tmp_delete_users', array(array(array('username' => "mockuser6b")))));
+var_dump($users = $client->call('user.delete_users', array(array(array('username' => "mockuser6b")))));
//print "<br/><br/>\n";
//var_dump($users = $client->call('user.tmp_do_multiple_user_searches', array(array(array('search' => "jerome"),array('search' => "admin")))));
//print "<br/><br/>\n";