0
モジュールのコンテキストではありませんアクセス権:私は Moodleのエラー - Webサービスクライアント - 私はMoodleの中で、次のセットアップを持っている
- グレードと呼ばれるサービスを追加して有効にしました
- サービスにmod_assign_get_grades機能を追加しました
- サービスの承認ユーザーとしてwebserviceユーザーを割り当てました
- 私はまた、作成され、
私が作るために以下のコードを使用している私も、ユーザーとサービスのトークンを作成した
/// SETUP - NEED TO BE CHANGED
$token = '068183c4c700bdcfe2b0bfe24a8043e2';
$domainname = 'http://localhost/Project/moodle';
$functionname = 'mod_assign_get_grades';
// REST RETURNED VALUES FORMAT
$restformat = 'xml'; //Also possible in Moodle 2.2 and later: 'json'
//Setting it to 'json' will fail all calls on earlier Moodle version
/// PARAMETERS - NEED TO BE CHANGED IF YOU CALL A DIFFERENT FUNCTION
$params = array('assignmentids' => array(1));
/// REST CALL
header('Content-Type: text/plain');
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;
require_once('./curl.php');
$curl = new curl;
//if rest format == 'xml', then we do not add the param for backward compatibility with Moodle < 2.2
$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:'';
$resp = $curl->post($serverurl . $restformat, $params);
print_r($resp);
私は次のエラーを取得する:
No access rights in module context
として、適切な機能と権限を割り当てて、どこに間違っているのかわからない限り、私は言うことができますか?