Moodle release 3.0rc3
[moodle.git] / lib / db / services.php
... / ...
CommitLineData
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17
18/**
19 * Core external functions and service definitions.
20 *
21 * The functions and services defined on this file are
22 * processed and registered into the Moodle DB after any
23 * install or upgrade operation. All plugins support this.
24 *
25 * For more information, take a look to the documentation available:
26 * - Webservices API: {@link http://docs.moodle.org/dev/Web_services_API}
27 * - External API: {@link http://docs.moodle.org/dev/External_functions_API}
28 * - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}
29 *
30 * @package core_webservice
31 * @category webservice
32 * @copyright 2009 Petr Skodak
33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34 */
35
36$functions = array(
37
38 // Cohort related functions.
39
40 'core_cohort_create_cohorts' => array(
41 'classname' => 'core_cohort_external',
42 'methodname' => 'create_cohorts',
43 'classpath' => 'cohort/externallib.php',
44 'description' => 'Creates new cohorts.',
45 'type' => 'write',
46 'capabilities'=> 'moodle/cohort:manage',
47 ),
48
49 'core_cohort_delete_cohorts' => array(
50 'classname' => 'core_cohort_external',
51 'methodname' => 'delete_cohorts',
52 'classpath' => 'cohort/externallib.php',
53 'description' => 'Deletes all specified cohorts.',
54 'type' => 'delete',
55 'capabilities'=> 'moodle/cohort:manage',
56 ),
57
58 'core_cohort_get_cohorts' => array(
59 'classname' => 'core_cohort_external',
60 'methodname' => 'get_cohorts',
61 'classpath' => 'cohort/externallib.php',
62 'description' => 'Returns cohort details.',
63 'type' => 'read',
64 'capabilities'=> 'moodle/cohort:view',
65 ),
66
67 'core_cohort_update_cohorts' => array(
68 'classname' => 'core_cohort_external',
69 'methodname' => 'update_cohorts',
70 'classpath' => 'cohort/externallib.php',
71 'description' => 'Updates existing cohorts.',
72 'type' => 'write',
73 'capabilities'=> 'moodle/cohort:manage',
74 ),
75
76 'core_cohort_add_cohort_members' => array(
77 'classname' => 'core_cohort_external',
78 'methodname' => 'add_cohort_members',
79 'classpath' => 'cohort/externallib.php',
80 'description' => 'Adds cohort members.',
81 'type' => 'write',
82 'capabilities'=> 'moodle/cohort:assign',
83 ),
84
85 'core_cohort_delete_cohort_members' => array(
86 'classname' => 'core_cohort_external',
87 'methodname' => 'delete_cohort_members',
88 'classpath' => 'cohort/externallib.php',
89 'description' => 'Deletes cohort members.',
90 'type' => 'delete',
91 'capabilities'=> 'moodle/cohort:assign',
92 ),
93
94 'core_cohort_get_cohort_members' => array(
95 'classname' => 'core_cohort_external',
96 'methodname' => 'get_cohort_members',
97 'classpath' => 'cohort/externallib.php',
98 'description' => 'Returns cohort members.',
99 'type' => 'read',
100 'capabilities'=> 'moodle/cohort:view',
101 ),
102
103 // Comments related functions.
104
105 'core_comment_get_comments' => array(
106 'classname' => 'core_comment_external',
107 'methodname' => 'get_comments',
108 'description' => 'Returns comments.',
109 'type' => 'read',
110 'capabilities' => 'moodle/comment:view',
111 ),
112
113 // Grade related functions.
114
115 'core_grades_get_grades' => array(
116 'classname' => 'core_grades_external',
117 'methodname' => 'get_grades',
118 'description' => 'Returns student course total grade and grades for activities.
119 This function does not return category or manual items.
120 This function is suitable for managers or teachers not students.',
121 'type' => 'read',
122 'capabilities' => 'moodle/grade:view, moodle/grade:viewall, moodle/grade:viewhidden',
123 ),
124
125 'core_grades_update_grades' => array(
126 'classname' => 'core_grades_external',
127 'methodname' => 'update_grades',
128 'description' => 'Update a grade item and associated student grades.',
129 'type' => 'write',
130 'capabilities' => '',
131 ),
132
133 // === group related functions ===
134
135 'moodle_group_create_groups' => array(
136 'classname' => 'moodle_group_external',
137 'methodname' => 'create_groups',
138 'classpath' => 'group/externallib.php',
139 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_create_groups(). ',
140 'type' => 'write',
141 'capabilities'=> 'moodle/course:managegroups',
142 ),
143
144 'core_group_create_groups' => array(
145 'classname' => 'core_group_external',
146 'methodname' => 'create_groups',
147 'classpath' => 'group/externallib.php',
148 'description' => 'Creates new groups.',
149 'type' => 'write',
150 'capabilities'=> 'moodle/course:managegroups',
151 ),
152
153 'moodle_group_get_groups' => array(
154 'classname' => 'moodle_group_external',
155 'methodname' => 'get_groups',
156 'classpath' => 'group/externallib.php',
157 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_groups()',
158 'type' => 'read',
159 'capabilities'=> 'moodle/course:managegroups',
160 ),
161
162 'core_group_get_groups' => array(
163 'classname' => 'core_group_external',
164 'methodname' => 'get_groups',
165 'classpath' => 'group/externallib.php',
166 'description' => 'Returns group details.',
167 'type' => 'read',
168 'capabilities'=> 'moodle/course:managegroups',
169 ),
170
171 'moodle_group_get_course_groups' => array(
172 'classname' => 'moodle_group_external',
173 'methodname' => 'get_course_groups',
174 'classpath' => 'group/externallib.php',
175 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_course_groups()',
176 'type' => 'read',
177 'capabilities'=> 'moodle/course:managegroups',
178 ),
179
180 'core_group_get_course_groups' => array(
181 'classname' => 'core_group_external',
182 'methodname' => 'get_course_groups',
183 'classpath' => 'group/externallib.php',
184 'description' => 'Returns all groups in specified course.',
185 'type' => 'read',
186 'capabilities'=> 'moodle/course:managegroups',
187 ),
188
189 'moodle_group_delete_groups' => array(
190 'classname' => 'moodle_group_external',
191 'methodname' => 'delete_groups',
192 'classpath' => 'group/externallib.php',
193 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_groups()',
194 'type' => 'delete',
195 'capabilities'=> 'moodle/course:managegroups',
196 ),
197
198 'core_group_delete_groups' => array(
199 'classname' => 'core_group_external',
200 'methodname' => 'delete_groups',
201 'classpath' => 'group/externallib.php',
202 'description' => 'Deletes all specified groups.',
203 'type' => 'delete',
204 'capabilities'=> 'moodle/course:managegroups',
205 ),
206
207 'moodle_group_get_groupmembers' => array(
208 'classname' => 'moodle_group_external',
209 'methodname' => 'get_groupmembers',
210 'classpath' => 'group/externallib.php',
211 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_group_members()',
212 'type' => 'read',
213 'capabilities'=> 'moodle/course:managegroups',
214 ),
215
216 'core_group_get_group_members' => array(
217 'classname' => 'core_group_external',
218 'methodname' => 'get_group_members',
219 'classpath' => 'group/externallib.php',
220 'description' => 'Returns group members.',
221 'type' => 'read',
222 'capabilities'=> 'moodle/course:managegroups',
223 ),
224
225 'moodle_group_add_groupmembers' => array(
226 'classname' => 'moodle_group_external',
227 'methodname' => 'add_groupmembers',
228 'classpath' => 'group/externallib.php',
229 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_add_group_members()',
230 'type' => 'write',
231 'capabilities'=> 'moodle/course:managegroups',
232 ),
233
234 'core_group_add_group_members' => array(
235 'classname' => 'core_group_external',
236 'methodname' => 'add_group_members',
237 'classpath' => 'group/externallib.php',
238 'description' => 'Adds group members.',
239 'type' => 'write',
240 'capabilities'=> 'moodle/course:managegroups',
241 ),
242
243 'moodle_group_delete_groupmembers' => array(
244 'classname' => 'moodle_group_external',
245 'methodname' => 'delete_groupmembers',
246 'classpath' => 'group/externallib.php',
247 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_group_members()',
248 'type' => 'delete',
249 'capabilities'=> 'moodle/course:managegroups',
250 ),
251
252 'core_group_delete_group_members' => array(
253 'classname' => 'core_group_external',
254 'methodname' => 'delete_group_members',
255 'classpath' => 'group/externallib.php',
256 'description' => 'Deletes group members.',
257 'type' => 'delete',
258 'capabilities'=> 'moodle/course:managegroups',
259 ),
260
261 'core_group_create_groupings' => array(
262 'classname' => 'core_group_external',
263 'methodname' => 'create_groupings',
264 'classpath' => 'group/externallib.php',
265 'description' => 'Creates new groupings',
266 'type' => 'write',
267 ),
268
269 'core_group_update_groupings' => array(
270 'classname' => 'core_group_external',
271 'methodname' => 'update_groupings',
272 'classpath' => 'group/externallib.php',
273 'description' => 'Updates existing groupings',
274 'type' => 'write',
275 ),
276
277 'core_group_get_groupings' => array(
278 'classname' => 'core_group_external',
279 'methodname' => 'get_groupings',
280 'classpath' => 'group/externallib.php',
281 'description' => 'Returns groupings details.',
282 'type' => 'read',
283 ),
284
285 'core_group_get_course_groupings' => array(
286 'classname' => 'core_group_external',
287 'methodname' => 'get_course_groupings',
288 'classpath' => 'group/externallib.php',
289 'description' => 'Returns all groupings in specified course.',
290 'type' => 'read',
291 ),
292
293 'core_group_delete_groupings' => array(
294 'classname' => 'core_group_external',
295 'methodname' => 'delete_groupings',
296 'classpath' => 'group/externallib.php',
297 'description' => 'Deletes all specified groupings.',
298 'type' => 'write',
299 ),
300
301 'core_group_assign_grouping' => array(
302 'classname' => 'core_group_external',
303 'methodname' => 'assign_grouping',
304 'classpath' => 'group/externallib.php',
305 'description' => 'Assing groups from groupings',
306 'type' => 'write',
307 ),
308
309 'core_group_unassign_grouping' => array(
310 'classname' => 'core_group_external',
311 'methodname' => 'unassign_grouping',
312 'classpath' => 'group/externallib.php',
313 'description' => 'Unassing groups from groupings',
314 'type' => 'write',
315 ),
316
317 'core_group_get_course_user_groups' => array(
318 'classname' => 'core_group_external',
319 'methodname' => 'get_course_user_groups',
320 'classpath' => 'group/externallib.php',
321 'description' => 'Returns all groups in specified course for the specified user.',
322 'type' => 'read',
323 'capabilities' => 'moodle/course:managegroups',
324 ),
325
326 'core_group_get_activity_allowed_groups' => array(
327 'classname' => 'core_group_external',
328 'methodname' => 'get_activity_allowed_groups',
329 'classpath' => 'group/externallib.php',
330 'description' => 'Gets a list of groups that the user is allowed to access within the specified activity.',
331 'type' => 'read',
332 'capabilities' => '',
333 ),
334
335 'core_group_get_activity_groupmode' => array(
336 'classname' => 'core_group_external',
337 'methodname' => 'get_activity_groupmode',
338 'classpath' => 'group/externallib.php',
339 'description' => 'Returns effective groupmode used in a given activity.',
340 'type' => 'read',
341 'capabilities' => '',
342 ),
343
344 'core_notes_get_course_notes' => array(
345 'classname' => 'core_notes_external',
346 'methodname' => 'get_course_notes',
347 'classpath' => 'notes/externallib.php',
348 'description' => 'Returns all notes in specified course (or site) for the specified user.',
349 'type' => 'read',
350 'capabilities' => 'moodle/notes:view',
351 ),
352
353 // === file related functions ===
354
355 'moodle_file_get_files' => array(
356 'classname' => 'moodle_file_external',
357 'methodname' => 'get_files',
358 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_get_files()',
359 'type' => 'read',
360 'classpath' => 'files/externallib.php',
361 ),
362
363 'core_files_get_files' => array(
364 'classname' => 'core_files_external',
365 'methodname' => 'get_files',
366 'description' => 'browse moodle files',
367 'type' => 'read',
368 'classpath' => 'files/externallib.php',
369 ),
370
371 'moodle_file_upload' => array(
372 'classname' => 'moodle_file_external',
373 'methodname' => 'upload',
374 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_upload()',
375 'type' => 'write',
376 'classpath' => 'files/externallib.php',
377 ),
378
379 'core_files_upload' => array(
380 'classname' => 'core_files_external',
381 'methodname' => 'upload',
382 'description' => 'upload a file to moodle',
383 'type' => 'write',
384 'classpath' => 'files/externallib.php',
385 ),
386
387 // === user related functions ===
388
389 'moodle_user_create_users' => array(
390 'classname' => 'moodle_user_external',
391 'methodname' => 'create_users',
392 'classpath' => 'user/externallib.php',
393 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_create_users()',
394 'type' => 'write',
395 'capabilities'=> 'moodle/user:create',
396 ),
397
398 'core_user_create_users' => array(
399 'classname' => 'core_user_external',
400 'methodname' => 'create_users',
401 'classpath' => 'user/externallib.php',
402 'description' => 'Create users.',
403 'type' => 'write',
404 'capabilities'=> 'moodle/user:create',
405 ),
406
407 'core_user_get_users' => array(
408 'classname' => 'core_user_external',
409 'methodname' => 'get_users',
410 'classpath' => 'user/externallib.php',
411 'description' => 'search for users matching the parameters',
412 'type' => 'read',
413 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
414 ),
415
416 'moodle_user_get_users_by_id' => array(
417 'classname' => 'moodle_user_external',
418 'methodname' => 'get_users_by_id',
419 'classpath' => 'user/externallib.php',
420 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. Use core_user_get_users_by_field service instead',
421 'type' => 'read',
422 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
423 ),
424
425 'core_user_get_users_by_field' => array(
426 'classname' => 'core_user_external',
427 'methodname' => 'get_users_by_field',
428 'classpath' => 'user/externallib.php',
429 'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()',
430 'type' => 'read',
431 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
432 ),
433
434 'core_user_get_users_by_id' => array(
435 'classname' => 'core_user_external',
436 'methodname' => 'get_users_by_id',
437 'classpath' => 'user/externallib.php',
438 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been replaced by core_user_get_users_by_field()',
439 'type' => 'read',
440 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
441 ),
442
443 'moodle_user_get_users_by_courseid' => array(
444 'classname' => 'moodle_user_external',
445 'methodname' => 'get_users_by_courseid',
446 'classpath' => 'user/externallib.php',
447 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_enrolled_users()',
448 'type' => 'read',
449 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
450 ),
451
452 'moodle_user_get_course_participants_by_id' => array(
453 'classname' => 'moodle_user_external',
454 'methodname' => 'get_course_participants_by_id',
455 'classpath' => 'user/externallib.php',
456 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_get_course_user_profiles()',
457 'type' => 'read',
458 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
459 ),
460
461 'core_user_get_course_user_profiles' => array(
462 'classname' => 'core_user_external',
463 'methodname' => 'get_course_user_profiles',
464 'classpath' => 'user/externallib.php',
465 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
466 'type' => 'read',
467 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
468 ),
469
470 'moodle_user_delete_users' => array(
471 'classname' => 'moodle_user_external',
472 'methodname' => 'delete_users',
473 'classpath' => 'user/externallib.php',
474 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_delete_users()',
475 'type' => 'write',
476 'capabilities'=> 'moodle/user:delete',
477 ),
478
479 'core_user_delete_users' => array(
480 'classname' => 'core_user_external',
481 'methodname' => 'delete_users',
482 'classpath' => 'user/externallib.php',
483 'description' => 'Delete users.',
484 'type' => 'write',
485 'capabilities'=> 'moodle/user:delete',
486 ),
487
488 'moodle_user_update_users' => array(
489 'classname' => 'moodle_user_external',
490 'methodname' => 'update_users',
491 'classpath' => 'user/externallib.php',
492 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_update_users()',
493 'type' => 'write',
494 'capabilities'=> 'moodle/user:update',
495 ),
496
497 'core_user_update_users' => array(
498 'classname' => 'core_user_external',
499 'methodname' => 'update_users',
500 'classpath' => 'user/externallib.php',
501 'description' => 'Update users.',
502 'type' => 'write',
503 'capabilities'=> 'moodle/user:update',
504 ),
505
506 'core_user_add_user_device' => array(
507 'classname' => 'core_user_external',
508 'methodname' => 'add_user_device',
509 'classpath' => 'user/externallib.php',
510 'description' => 'Store mobile user devices information for PUSH Notifications.',
511 'type' => 'write',
512 'capabilities'=> '',
513 ),
514
515 'core_user_remove_user_device' => array(
516 'classname' => 'core_user_external',
517 'methodname' => 'remove_user_device',
518 'classpath' => 'user/externallib.php',
519 'description' => 'Remove a user device from the Moodle database.',
520 'type' => 'write',
521 'capabilities' => '',
522 ),
523
524 'core_user_view_user_list' => array(
525 'classname' => 'core_user_external',
526 'methodname' => 'view_user_list',
527 'classpath' => 'user/externallib.php',
528 'description' => 'Simulates the web-interface view of user/index.php (triggering events).',
529 'type' => 'write',
530 'capabilities' => 'moodle/course:viewparticipants',
531 ),
532
533 'core_user_view_user_profile' => array(
534 'classname' => 'core_user_external',
535 'methodname' => 'view_user_profile',
536 'classpath' => 'user/externallib.php',
537 'description' => 'Simulates the web-interface view of user/view.php and user/profile.php (triggering events).',
538 'type' => 'write',
539 'capabilities' => 'moodle/user:viewdetails',
540 ),
541
542 'core_user_add_user_private_files' => array(
543 'classname' => 'core_user_external',
544 'methodname' => 'add_user_private_files',
545 'classpath' => 'user/externallib.php',
546 'description' => 'Copy files from a draft area to users private files area.',
547 'type' => 'write',
548 'capabilities' => 'moodle/user:manageownfiles',
549 ),
550
551 // === enrol related functions ===
552
553 'core_enrol_get_enrolled_users_with_capability' => array(
554 'classname' => 'core_enrol_external',
555 'methodname' => 'get_enrolled_users_with_capability',
556 'classpath' => 'enrol/externallib.php',
557 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
558 and have that capability',
559 'type' => 'read',
560 ),
561
562 'moodle_enrol_get_enrolled_users' => array(
563 'classname' => 'moodle_enrol_external',
564 'methodname' => 'get_enrolled_users',
565 'classpath' => 'enrol/externallib.php',
566 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. Please use core_enrol_get_enrolled_users() (previously known as moodle_user_get_users_by_courseid).',
567 'type' => 'read',
568 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
569 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
570 ),
571
572 'core_enrol_get_enrolled_users' => array(
573 'classname' => 'core_enrol_external',
574 'methodname' => 'get_enrolled_users',
575 'classpath' => 'enrol/externallib.php',
576 'description' => 'Get enrolled users by course id.',
577 'type' => 'read',
578 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
579 ),
580
581 'moodle_enrol_get_users_courses' => array(
582 'classname' => 'moodle_enrol_external',
583 'methodname' => 'get_users_courses',
584 'classpath' => 'enrol/externallib.php',
585 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_users_courses()',
586 'type' => 'read',
587 'capabilities'=> 'moodle/course:viewparticipants',
588 ),
589
590 'core_enrol_get_users_courses' => array(
591 'classname' => 'core_enrol_external',
592 'methodname' => 'get_users_courses',
593 'classpath' => 'enrol/externallib.php',
594 'description' => 'Get the list of courses where a user is enrolled in',
595 'type' => 'read',
596 'capabilities'=> 'moodle/course:viewparticipants',
597 ),
598
599 'core_enrol_get_course_enrolment_methods' => array(
600 'classname' => 'core_enrol_external',
601 'methodname' => 'get_course_enrolment_methods',
602 'classpath' => 'enrol/externallib.php',
603 'description' => 'Get the list of course enrolment methods',
604 'type' => 'read',
605 ),
606
607 // === Role related functions ===
608
609 'moodle_role_assign' => array(
610 'classname' => 'moodle_enrol_external',
611 'methodname' => 'role_assign',
612 'classpath' => 'enrol/externallib.php',
613 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()',
614 'type' => 'write',
615 'capabilities'=> 'moodle/role:assign',
616 ),
617
618 'core_role_assign_roles' => array(
619 'classname' => 'core_role_external',
620 'methodname' => 'assign_roles',
621 'classpath' => 'enrol/externallib.php',
622 'description' => 'Manual role assignments.',
623 'type' => 'write',
624 'capabilities'=> 'moodle/role:assign',
625 ),
626
627 'moodle_role_unassign' => array(
628 'classname' => 'moodle_enrol_external',
629 'methodname' => 'role_unassign',
630 'classpath' => 'enrol/externallib.php',
631 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()',
632 'type' => 'write',
633 'capabilities'=> 'moodle/role:assign',
634 ),
635
636 'core_role_unassign_roles' => array(
637 'classname' => 'core_role_external',
638 'methodname' => 'unassign_roles',
639 'classpath' => 'enrol/externallib.php',
640 'description' => 'Manual role unassignments.',
641 'type' => 'write',
642 'capabilities'=> 'moodle/role:assign',
643 ),
644
645 // === course related functions ===
646
647 'core_course_get_contents' => array(
648 'classname' => 'core_course_external',
649 'methodname' => 'get_course_contents',
650 'classpath' => 'course/externallib.php',
651 'description' => 'Get course contents',
652 'type' => 'read',
653 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
654 ),
655
656 'moodle_course_get_courses' => array(
657 'classname' => 'moodle_course_external',
658 'methodname' => 'get_courses',
659 'classpath' => 'course/externallib.php',
660 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()',
661 'type' => 'read',
662 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
663 ),
664
665 'core_course_get_courses' => array(
666 'classname' => 'core_course_external',
667 'methodname' => 'get_courses',
668 'classpath' => 'course/externallib.php',
669 'description' => 'Return course details',
670 'type' => 'read',
671 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
672 ),
673
674 'core_course_search_courses' => array(
675 'classname' => 'core_course_external',
676 'methodname' => 'search_courses',
677 'classpath' => 'course/externallib.php',
678 'description' => 'Search courses by (name, module, block, tag)',
679 'type' => 'read',
680 'capabilities' => '',
681 ),
682
683 'moodle_course_create_courses' => array(
684 'classname' => 'moodle_course_external',
685 'methodname' => 'create_courses',
686 'classpath' => 'course/externallib.php',
687 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()',
688 'type' => 'write',
689 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
690 ),
691
692 'core_course_create_courses' => array(
693 'classname' => 'core_course_external',
694 'methodname' => 'create_courses',
695 'classpath' => 'course/externallib.php',
696 'description' => 'Create new courses',
697 'type' => 'write',
698 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
699 ),
700
701 'core_course_delete_courses' => array(
702 'classname' => 'core_course_external',
703 'methodname' => 'delete_courses',
704 'classpath' => 'course/externallib.php',
705 'description' => 'Deletes all specified courses',
706 'type' => 'write',
707 'capabilities'=> 'moodle/course:delete',
708 ),
709
710 'core_course_delete_modules' => array(
711 'classname' => 'core_course_external',
712 'methodname' => 'delete_modules',
713 'classpath' => 'course/externallib.php',
714 'description' => 'Deletes all specified module instances',
715 'type' => 'write',
716 'capabilities' => 'moodle/course:manageactivities'
717 ),
718
719 'core_course_duplicate_course' => array(
720 'classname' => 'core_course_external',
721 'methodname' => 'duplicate_course',
722 'classpath' => 'course/externallib.php',
723 'description' => 'Duplicate an existing course (creating a new one) without user data',
724 'type' => 'write',
725 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
726 ),
727
728 'core_course_update_courses' => array(
729 'classname' => 'core_course_external',
730 'methodname' => 'update_courses',
731 'classpath' => 'course/externallib.php',
732 'description' => 'Update courses',
733 'type' => 'write',
734 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
735 ),
736
737 'core_course_view_course' => array(
738 'classname' => 'core_course_external',
739 'methodname' => 'view_course',
740 'classpath' => 'course/externallib.php',
741 'description' => 'Log that the course was viewed',
742 'type' => 'write'
743 ),
744
745 'core_course_get_course_module' => array(
746 'classname' => 'core_course_external',
747 'methodname' => 'get_course_module',
748 'classpath' => 'course/externallib.php',
749 'description' => 'Return information about a course module',
750 'type' => 'read'
751 ),
752
753 'core_course_get_course_module_by_instance' => array(
754 'classname' => 'core_course_external',
755 'methodname' => 'get_course_module_by_instance',
756 'classpath' => 'course/externallib.php',
757 'description' => 'Return information about a given module name and instance id',
758 'type' => 'read'
759 ),
760
761 // === course category related functions ===
762
763 'core_course_get_categories' => array(
764 'classname' => 'core_course_external',
765 'methodname' => 'get_categories',
766 'classpath' => 'course/externallib.php',
767 'description' => 'Return category details',
768 'type' => 'read',
769 'capabilities'=> 'moodle/category:viewhiddencategories',
770 ),
771
772 'core_course_create_categories' => array(
773 'classname' => 'core_course_external',
774 'methodname' => 'create_categories',
775 'classpath' => 'course/externallib.php',
776 'description' => 'Create course categories',
777 'type' => 'write',
778 'capabilities'=> 'moodle/category:manage',
779 ),
780
781 'core_course_update_categories' => array(
782 'classname' => 'core_course_external',
783 'methodname' => 'update_categories',
784 'classpath' => 'course/externallib.php',
785 'description' => 'Update categories',
786 'type' => 'write',
787 'capabilities'=> 'moodle/category:manage',
788 ),
789
790 'core_course_delete_categories' => array(
791 'classname' => 'core_course_external',
792 'methodname' => 'delete_categories',
793 'classpath' => 'course/externallib.php',
794 'description' => 'Delete course categories',
795 'type' => 'write',
796 'capabilities'=> 'moodle/category:manage',
797 ),
798
799 'core_course_import_course' => array(
800 'classname' => 'core_course_external',
801 'methodname' => 'import_course',
802 'classpath' => 'course/externallib.php',
803 'description' => 'Import course data from a course into another course. Does not include any user data.',
804 'type' => 'write',
805 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
806 ),
807
808 // === message related functions ===
809
810 'moodle_message_send_instantmessages' => array(
811 'classname' => 'moodle_message_external',
812 'methodname' => 'send_instantmessages',
813 'classpath' => 'message/externallib.php',
814 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_message_send_instant_messages()',
815 'type' => 'write',
816 'capabilities'=> 'moodle/site:sendmessage',
817 ),
818
819 'core_message_send_instant_messages' => array(
820 'classname' => 'core_message_external',
821 'methodname' => 'send_instant_messages',
822 'classpath' => 'message/externallib.php',
823 'description' => 'Send instant messages',
824 'type' => 'write',
825 'capabilities'=> 'moodle/site:sendmessage',
826 ),
827
828 'core_message_create_contacts' => array(
829 'classname' => 'core_message_external',
830 'methodname' => 'create_contacts',
831 'classpath' => 'message/externallib.php',
832 'description' => 'Add contacts to the contact list',
833 'type' => 'write',
834 'capabilities'=> '',
835 ),
836
837 'core_message_delete_contacts' => array(
838 'classname' => 'core_message_external',
839 'methodname' => 'delete_contacts',
840 'classpath' => 'message/externallib.php',
841 'description' => 'Remove contacts from the contact list',
842 'type' => 'write',
843 'capabilities'=> '',
844 ),
845
846 'core_message_block_contacts' => array(
847 'classname' => 'core_message_external',
848 'methodname' => 'block_contacts',
849 'classpath' => 'message/externallib.php',
850 'description' => 'Block contacts',
851 'type' => 'write',
852 'capabilities'=> '',
853 ),
854
855 'core_message_unblock_contacts' => array(
856 'classname' => 'core_message_external',
857 'methodname' => 'unblock_contacts',
858 'classpath' => 'message/externallib.php',
859 'description' => 'Unblock contacts',
860 'type' => 'write',
861 'capabilities'=> '',
862 ),
863
864 'core_message_get_contacts' => array(
865 'classname' => 'core_message_external',
866 'methodname' => 'get_contacts',
867 'classpath' => 'message/externallib.php',
868 'description' => 'Retrieve the contact list',
869 'type' => 'read',
870 'capabilities'=> '',
871 ),
872
873 'core_message_search_contacts' => array(
874 'classname' => 'core_message_external',
875 'methodname' => 'search_contacts',
876 'classpath' => 'message/externallib.php',
877 'description' => 'Search for contacts',
878 'type' => 'read',
879 'capabilities'=> '',
880 ),
881
882 'core_message_get_messages' => array(
883 'classname' => 'core_message_external',
884 'methodname' => 'get_messages',
885 'classpath' => 'message/externallib.php',
886 'description' => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)',
887 'type' => 'read',
888 'capabilities' => '',
889 ),
890
891 'core_message_get_blocked_users' => array(
892 'classname' => 'core_message_external',
893 'methodname' => 'get_blocked_users',
894 'classpath' => 'message/externallib.php',
895 'description' => 'Retrieve a list of users blocked',
896 'type' => 'read',
897 'capabilities' => '',
898 ),
899
900 'core_message_mark_message_read' => array(
901 'classname' => 'core_message_external',
902 'methodname' => 'mark_message_read',
903 'classpath' => 'message/externallib.php',
904 'description' => 'Mark a single message as read, trigger message_viewed event.',
905 'type' => 'write',
906 'capabilities' => '',
907 ),
908
909 // === notes related functions ===
910
911 'moodle_notes_create_notes' => array(
912 'classname' => 'moodle_notes_external',
913 'methodname' => 'create_notes',
914 'classpath' => 'notes/externallib.php',
915 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()',
916 'type' => 'write',
917 'capabilities'=> 'moodle/notes:manage',
918 ),
919
920 'core_notes_create_notes' => array(
921 'classname' => 'core_notes_external',
922 'methodname' => 'create_notes',
923 'classpath' => 'notes/externallib.php',
924 'description' => 'Create notes',
925 'type' => 'write',
926 'capabilities'=> 'moodle/notes:manage',
927 ),
928
929 'core_notes_delete_notes' => array(
930 'classname' => 'core_notes_external',
931 'methodname' => 'delete_notes',
932 'classpath' => 'notes/externallib.php',
933 'description' => 'Delete notes',
934 'type' => 'write',
935 'capabilities'=> 'moodle/notes:manage',
936 ),
937
938 'core_notes_get_notes' => array(
939 'classname' => 'core_notes_external',
940 'methodname' => 'get_notes',
941 'classpath' => 'notes/externallib.php',
942 'description' => 'Get notes',
943 'type' => 'read',
944 'capabilities'=> 'moodle/notes:view',
945 ),
946
947 'core_notes_update_notes' => array(
948 'classname' => 'core_notes_external',
949 'methodname' => 'update_notes',
950 'classpath' => 'notes/externallib.php',
951 'description' => 'Update notes',
952 'type' => 'write',
953 'capabilities'=> 'moodle/notes:manage',
954 ),
955
956 'core_notes_view_notes' => array(
957 'classname' => 'core_notes_external',
958 'methodname' => 'view_notes',
959 'classpath' => 'notes/externallib.php',
960 'description' => 'Simulates the web interface view of notes/index.php: trigger events.',
961 'type' => 'write',
962 'capabilities' => 'moodle/notes:view',
963 ),
964
965 // === grading related functions ===
966
967 'core_grading_get_definitions' => array(
968 'classname' => 'core_grading_external',
969 'methodname' => 'get_definitions',
970 'description' => 'Get grading definitions',
971 'type' => 'read'
972 ),
973
974 'core_grade_get_definitions' => array(
975 'classname' => 'core_grade_external',
976 'methodname' => 'get_definitions',
977 'classpath' => 'grade/externallib.php',
978 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()',
979 'type' => 'read'
980 ),
981
982 'core_grading_save_definitions' => array(
983 'classname' => 'core_grading_external',
984 'methodname' => 'save_definitions',
985 'description' => 'Save grading definitions',
986 'type' => 'write'
987 ),
988
989 'core_grading_get_gradingform_instances' => array(
990 'classname' => 'core_grading_external',
991 'methodname' => 'get_gradingform_instances',
992 'description' => 'Get grading form instances',
993 'type' => 'read'
994 ),
995
996 // === webservice related functions ===
997
998 'moodle_webservice_get_siteinfo' => array(
999 'classname' => 'moodle_webservice_external',
1000 'methodname' => 'get_siteinfo',
1001 'classpath' => 'webservice/externallib.php',
1002 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_webservice_get_site_info()',
1003 'type' => 'read',
1004 ),
1005
1006 'core_webservice_get_site_info' => array(
1007 'classname' => 'core_webservice_external',
1008 'methodname' => 'get_site_info',
1009 'classpath' => 'webservice/externallib.php',
1010 'description' => 'Return some site info / user info / list web service functions',
1011 'type' => 'read',
1012 ),
1013
1014 'core_get_string' => array(
1015 'classname' => 'core_external',
1016 'methodname' => 'get_string',
1017 'classpath' => 'lib/external/externallib.php',
1018 'description' => 'Return a translated string - similar to core get_string() call',
1019 'type' => 'read',
1020 'loginrequired' => false,
1021 'ajax' => true,
1022 ),
1023
1024 'core_get_strings' => array(
1025 'classname' => 'core_external',
1026 'methodname' => 'get_strings',
1027 'classpath' => 'lib/external/externallib.php',
1028 'description' => 'Return some translated strings - like several core get_string() calls',
1029 'type' => 'read',
1030 'loginrequired' => false,
1031 'ajax' => true,
1032 ),
1033
1034 'core_get_component_strings' => array(
1035 'classname' => 'core_external',
1036 'methodname' => 'get_component_strings',
1037 'classpath' => 'lib/external/externallib.php',
1038 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
1039 - similar to core get_component_strings() call',
1040 'type' => 'read',
1041 'loginrequired' => false,
1042 'ajax' => true,
1043 ),
1044
1045
1046 // === Calendar related functions ===
1047
1048 'core_calendar_delete_calendar_events' => array(
1049 'classname' => 'core_calendar_external',
1050 'methodname' => 'delete_calendar_events',
1051 'description' => 'Delete calendar events',
1052 'classpath' => 'calendar/externallib.php',
1053 'type' => 'write',
1054 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1055 ),
1056
1057
1058 'core_calendar_get_calendar_events' => array(
1059 'classname' => 'core_calendar_external',
1060 'methodname' => 'get_calendar_events',
1061 'description' => 'Get calendar events',
1062 'classpath' => 'calendar/externallib.php',
1063 'type' => 'read',
1064 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1065 ),
1066
1067 'core_calendar_create_calendar_events' => array(
1068 'classname' => 'core_calendar_external',
1069 'methodname' => 'create_calendar_events',
1070 'description' => 'Create calendar events',
1071 'classpath' => 'calendar/externallib.php',
1072 'type' => 'write',
1073 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1074 ),
1075
1076 'core_output_load_template' => array(
1077 'classname' => 'core\output\external',
1078 'methodname' => 'load_template',
1079 'description' => 'Load a template for a renderable',
1080 'type' => 'read',
1081 'loginrequired' => false,
1082 'ajax' => true,
1083 ),
1084
1085 // Completion related functions.
1086 'core_completion_update_activity_completion_status_manually' => array(
1087 'classname' => 'core_completion_external',
1088 'methodname' => 'update_activity_completion_status_manually',
1089 'description' => 'Update completion status for the current user in an activity, only for activities with manual tracking.',
1090 'type' => 'write',
1091 ),
1092
1093 'core_completion_mark_course_self_completed' => array(
1094 'classname' => 'core_completion_external',
1095 'methodname' => 'mark_course_self_completed',
1096 'description' => 'Update the course completion status for the current user (if course self-completion is enabled).',
1097 'type' => 'write',
1098 ),
1099
1100 'core_completion_get_activities_completion_status' => array(
1101 'classname' => 'core_completion_external',
1102 'methodname' => 'get_activities_completion_status',
1103 'description' => 'Return the activities completion status for a user in a course.',
1104 'type' => 'read',
1105 'capabilities' => '',
1106 ),
1107
1108 'core_completion_get_course_completion_status' => array(
1109 'classname' => 'core_completion_external',
1110 'methodname' => 'get_course_completion_status',
1111 'description' => 'Returns course completion status.',
1112 'type' => 'read',
1113 'capabilities' => 'report/completion:view',
1114 ),
1115
1116 // Rating functions.
1117 'core_rating_get_item_ratings' => array(
1118 'classname' => 'core_rating_external',
1119 'methodname' => 'get_item_ratings',
1120 'description' => 'Retrieve all the ratings for an item.',
1121 'type' => 'read',
1122 'capabilities' => 'moodle/rating:view'
1123 ),
1124
1125 // Tag functions.
1126 'core_tag_update_tags' => array(
1127 'classname' => 'core_tag_external',
1128 'methodname' => 'update_tags',
1129 'description' => 'Updates tags',
1130 'type' => 'write',
1131 'ajax' => true
1132 ),
1133
1134 'core_tag_get_tags' => array(
1135 'classname' => 'core_tag_external',
1136 'methodname' => 'get_tags',
1137 'description' => 'Gets tags by their ids',
1138 'type' => 'read',
1139 'ajax' => true
1140 ),
1141
1142);
1143
1144$services = array(
1145 'Moodle mobile web service' => array(
1146 'functions' => array (
1147 'moodle_enrol_get_users_courses',
1148 'moodle_enrol_get_enrolled_users',
1149 'moodle_user_get_users_by_id',
1150 'moodle_webservice_get_siteinfo',
1151 'moodle_notes_create_notes',
1152 'moodle_user_get_course_participants_by_id',
1153 'moodle_user_get_users_by_courseid',
1154 'moodle_message_send_instantmessages',
1155 'core_course_get_contents',
1156 'core_get_component_strings',
1157 'core_user_add_user_device',
1158 'core_calendar_get_calendar_events',
1159 'core_enrol_get_users_courses',
1160 'core_enrol_get_enrolled_users',
1161 'enrol_self_enrol_user',
1162 'core_user_get_users_by_id',
1163 'core_webservice_get_site_info',
1164 'core_notes_create_notes',
1165 'core_user_get_course_user_profiles',
1166 'core_message_send_instant_messages',
1167 'mod_assign_get_grades',
1168 'mod_assign_get_assignments',
1169 'mod_assign_get_submissions',
1170 'mod_assign_get_user_flags',
1171 'mod_assign_set_user_flags',
1172 'mod_assign_get_user_mappings',
1173 'mod_assign_revert_submissions_to_draft',
1174 'mod_assign_lock_submissions',
1175 'mod_assign_unlock_submissions',
1176 'mod_assign_save_submission',
1177 'mod_assign_submit_for_grading',
1178 'mod_assign_save_grade',
1179 'mod_assign_save_user_extensions',
1180 'mod_assign_reveal_identities',
1181 'message_airnotifier_is_system_configured',
1182 'message_airnotifier_are_notification_preferences_configured',
1183 'core_grades_update_grades',
1184 'mod_forum_get_forums_by_courses',
1185 'mod_forum_get_forum_discussions_paginated',
1186 'mod_forum_get_forum_discussion_posts',
1187 'mod_forum_add_discussion_post',
1188 'mod_forum_add_discussion',
1189 'core_files_get_files',
1190 'core_message_get_messages',
1191 'core_message_create_contacts',
1192 'core_message_delete_contacts',
1193 'core_message_block_contacts',
1194 'core_message_unblock_contacts',
1195 'core_message_get_contacts',
1196 'core_message_search_contacts',
1197 'core_message_get_blocked_users',
1198 'gradereport_user_get_grades_table',
1199 'core_group_get_course_user_groups',
1200 'core_group_get_activity_allowed_groups',
1201 'core_group_get_activity_groupmode',
1202 'core_user_remove_user_device',
1203 'core_course_get_courses',
1204 'core_completion_update_activity_completion_status_manually',
1205 'core_completion_mark_course_self_completed',
1206 'mod_data_get_databases_by_courses',
1207 'core_comment_get_comments',
1208 'mod_forum_view_forum',
1209 'core_course_view_course',
1210 'core_course_search_courses',
1211 'core_course_get_course_module',
1212 'core_course_get_course_module_by_instance',
1213 'core_completion_get_activities_completion_status',
1214 'core_notes_get_course_notes',
1215 'core_completion_get_course_completion_status',
1216 'core_user_view_user_list',
1217 'core_message_mark_message_read',
1218 'core_notes_view_notes',
1219 'mod_forum_view_forum_discussion',
1220 'core_user_view_user_profile',
1221 'gradereport_user_view_grade_report',
1222 'core_rating_get_item_ratings',
1223 'mod_url_view_url',
1224 'core_user_get_users_by_field',
1225 'core_user_add_user_private_files',
1226 'mod_assign_view_grading_table',
1227 'mod_scorm_view_scorm',
1228 'mod_scorm_get_scorm_scoes',
1229 'mod_scorm_get_scorm_user_data',
1230 'mod_scorm_insert_scorm_tracks',
1231 'mod_scorm_get_scorm_sco_tracks',
1232 'mod_scorm_get_scorm_attempt_count',
1233 'mod_scorm_get_scorms_by_courses',
1234 'mod_survey_get_surveys_by_courses',
1235 'mod_survey_view_survey',
1236 'mod_survey_get_questions',
1237 'mod_survey_submit_answers',
1238 'mod_page_view_page',
1239 'mod_resource_view_resource',
1240 'mod_folder_view_folder',
1241 'mod_chat_login_user',
1242 'mod_chat_get_chat_users',
1243 'mod_chat_send_chat_message',
1244 'mod_chat_get_chat_latest_messages',
1245 'mod_chat_view_chat',
1246 'mod_chat_get_chats_by_courses',
1247 'mod_book_view_book',
1248 'mod_book_get_books_by_courses',
1249 'mod_choice_get_choice_results',
1250 'mod_choice_get_choice_options',
1251 'mod_choice_submit_choice_response',
1252 'mod_choice_view_choice',
1253 'mod_choice_get_choices_by_courses',
1254 'mod_choice_delete_choice_responses',
1255 'mod_lti_get_tool_launch_data',
1256 'mod_lti_get_ltis_by_courses',
1257 'mod_lti_view_lti',
1258 'mod_imscp_view_imscp',
1259 'mod_imscp_get_imscps_by_courses',
1260 ),
1261 'enabled' => 0,
1262 'restrictedusers' => 0,
1263 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
1264 'downloadfiles' => 1,
1265 'uploadfiles' => 1
1266 ),
1267);