]> git.mjollnir.org Git - moodle.git/commitdiff
web service MDL-12886 temporary: REST protocol uses a special user by default (wsuser...
authorjerome <jerome>
Fri, 23 Jan 2009 07:19:34 +0000 (07:19 +0000)
committerjerome <jerome>
Fri, 23 Jan 2009 07:19:34 +0000 (07:19 +0000)
webservice/rest/locallib.php
webservice/rest/testclient/createuser.php
webservice/rest/testclient/deleteuser.php
webservice/rest/testclient/getusers.php
webservice/rest/testclient/updateuser.php

index 9297c9b844321d2b51be0211c819984f347829db..b93a186b67ab1f80f318c460f88100a3a2a1de56 100644 (file)
@@ -32,18 +32,21 @@ function call_moodle_function ($rest_arguments) {
         if ($functionname != 'tmp_get_token') {
             throw new moodle_exception('identifyfirst');
         } else {
-            if (optional_param('username',null,PARAM_ALPHANUM) == 'admin' && optional_param('password',null,PARAM_ALPHANUM) == 'admin') {
+            ///TODO: authentication + token generation need to be implemented
+            if (optional_param('username',null,PARAM_ALPHANUM) == 'wsuser' && optional_param('password',null,PARAM_ALPHANUM) == 'wspassword') {
                 return '465465465468468464';
             } else {
                 throw new moodle_exception('wrongusernamepassword');
             }
         }
     } else {
+        ///TDO: following function will need to be modified
         $user = mock_check_token($token);
         if (empty($user)) {
             throw new moodle_exception('wrongidentification');
         }
         else {
+            ///TODO: probably change this
             $USER = $user;
         }
     }
@@ -82,7 +85,7 @@ function mock_check_token($token) {
     if ($token == 465465465468468464) {
         ///retrieve the user
         global $DB;
-        $user = $DB->get_record('user', array('username'=>'admin', 'mnethostid'=>1));
+        $user = $DB->get_record('user', array('username'=>'wsuser', 'mnethostid'=>1));
 
         if (empty($user)) {
             return false;
index 3b86fab617660811df6d7e268450ba8265f2b680..3b2f8e0c651a417520f9853d69568ff2850db72a 100644 (file)
@@ -22,8 +22,8 @@ $data['email'] = "mockuser5@lastname.com";
 var_dump($data);
 
 //we are asking for a token
-$connectiondata['username'] = 'admin';
-$connectiondata['password'] = 'admin';
+$connectiondata['username'] = 'wsuser';
+$connectiondata['password'] = 'wspassword';
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
index a83e99bd46feb3623b73bf2bfb1aabf76f61076e..e65f4ec7ed53e1b573e7fc5d9cf96883a574e2a4 100644 (file)
@@ -32,8 +32,8 @@ start_interface("Delete a user");
 if ($username) {
   
      //we are asking for a token
-    $connectiondata['username'] = 'admin';
-    $connectiondata['password'] = 'admin';
+    $connectiondata['username'] = 'wsuser';
+    $connectiondata['password'] = 'wspassword';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
index 44e9eef1d264715164686d73d53862b49167ebfd..0f1567ac06b2bc07df6ecc42a47eec44faabcf77 100644 (file)
@@ -36,8 +36,8 @@ if ($search) {
 
     
     //we are asking for a token
-    $connectiondata['username'] = 'admin';
-    $connectiondata['password'] = 'admin';
+    $connectiondata['username'] = 'wsuser';
+    $connectiondata['password'] = 'wspassword';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
index 65b9fd94c3fab50dbc0213ed00823c6122c24c18..978ca0b687bd4c17973bd7d338724351a89f62c7 100644 (file)
@@ -34,8 +34,8 @@ start_interface("Update a user");
 if ($username) {
 
     //we are asking for a token
-    $connectiondata['username'] = 'admin';
-    $connectiondata['password'] = 'admin';
+    $connectiondata['username'] = 'wsuser';
+    $connectiondata['password'] = 'wspassword';
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $CFG->serverurl.'/user/tmp_get_token');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);