MDL-53700 competency: Migrating tests to core
[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 'ajax' => true,
432 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
433 ),
434
435 'core_user_get_users_by_id' => array(
436 'classname' => 'core_user_external',
437 'methodname' => 'get_users_by_id',
438 'classpath' => 'user/externallib.php',
439 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been replaced by core_user_get_users_by_field()',
440 'type' => 'read',
441 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
442 ),
443
444 'moodle_user_get_users_by_courseid' => array(
445 'classname' => 'moodle_user_external',
446 'methodname' => 'get_users_by_courseid',
447 'classpath' => 'user/externallib.php',
448 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_enrolled_users()',
449 'type' => 'read',
450 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
451 ),
452
453 'moodle_user_get_course_participants_by_id' => array(
454 'classname' => 'moodle_user_external',
455 'methodname' => 'get_course_participants_by_id',
456 'classpath' => 'user/externallib.php',
457 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_get_course_user_profiles()',
458 'type' => 'read',
459 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
460 ),
461
462 'core_user_get_course_user_profiles' => array(
463 'classname' => 'core_user_external',
464 'methodname' => 'get_course_user_profiles',
465 'classpath' => 'user/externallib.php',
466 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
467 'type' => 'read',
468 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
469 ),
470
471 'moodle_user_delete_users' => array(
472 'classname' => 'moodle_user_external',
473 'methodname' => 'delete_users',
474 'classpath' => 'user/externallib.php',
475 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_delete_users()',
476 'type' => 'write',
477 'capabilities'=> 'moodle/user:delete',
478 ),
479
480 'core_user_delete_users' => array(
481 'classname' => 'core_user_external',
482 'methodname' => 'delete_users',
483 'classpath' => 'user/externallib.php',
484 'description' => 'Delete users.',
485 'type' => 'write',
486 'capabilities'=> 'moodle/user:delete',
487 ),
488
489 'moodle_user_update_users' => array(
490 'classname' => 'moodle_user_external',
491 'methodname' => 'update_users',
492 'classpath' => 'user/externallib.php',
493 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_update_users()',
494 'type' => 'write',
495 'capabilities'=> 'moodle/user:update',
496 ),
497
498 'core_user_update_users' => array(
499 'classname' => 'core_user_external',
500 'methodname' => 'update_users',
501 'classpath' => 'user/externallib.php',
502 'description' => 'Update users.',
503 'type' => 'write',
504 'capabilities'=> 'moodle/user:update',
505 ),
506
507 'core_user_add_user_device' => array(
508 'classname' => 'core_user_external',
509 'methodname' => 'add_user_device',
510 'classpath' => 'user/externallib.php',
511 'description' => 'Store mobile user devices information for PUSH Notifications.',
512 'type' => 'write',
513 'capabilities'=> '',
514 ),
515
516 'core_user_remove_user_device' => array(
517 'classname' => 'core_user_external',
518 'methodname' => 'remove_user_device',
519 'classpath' => 'user/externallib.php',
520 'description' => 'Remove a user device from the Moodle database.',
521 'type' => 'write',
522 'capabilities' => '',
523 ),
524
525 'core_user_view_user_list' => array(
526 'classname' => 'core_user_external',
527 'methodname' => 'view_user_list',
528 'classpath' => 'user/externallib.php',
529 'description' => 'Simulates the web-interface view of user/index.php (triggering events).',
530 'type' => 'write',
531 'capabilities' => 'moodle/course:viewparticipants',
532 ),
533
534 'core_user_view_user_profile' => array(
535 'classname' => 'core_user_external',
536 'methodname' => 'view_user_profile',
537 'classpath' => 'user/externallib.php',
538 'description' => 'Simulates the web-interface view of user/view.php and user/profile.php (triggering events).',
539 'type' => 'write',
540 'capabilities' => 'moodle/user:viewdetails',
541 ),
542
543 'core_user_add_user_private_files' => array(
544 'classname' => 'core_user_external',
545 'methodname' => 'add_user_private_files',
546 'classpath' => 'user/externallib.php',
547 'description' => 'Copy files from a draft area to users private files area.',
548 'type' => 'write',
549 'capabilities' => 'moodle/user:manageownfiles',
550 ),
551
552 // === enrol related functions ===
553
554 'core_enrol_get_enrolled_users_with_capability' => array(
555 'classname' => 'core_enrol_external',
556 'methodname' => 'get_enrolled_users_with_capability',
557 'classpath' => 'enrol/externallib.php',
558 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
559 and have that capability',
560 'type' => 'read',
561 ),
562
563 'moodle_enrol_get_enrolled_users' => array(
564 'classname' => 'moodle_enrol_external',
565 'methodname' => 'get_enrolled_users',
566 'classpath' => 'enrol/externallib.php',
567 '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).',
568 'type' => 'read',
569 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
570 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
571 ),
572
573 'core_enrol_get_enrolled_users' => array(
574 'classname' => 'core_enrol_external',
575 'methodname' => 'get_enrolled_users',
576 'classpath' => 'enrol/externallib.php',
577 'description' => 'Get enrolled users by course id.',
578 'type' => 'read',
579 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
580 ),
581
582 'moodle_enrol_get_users_courses' => array(
583 'classname' => 'moodle_enrol_external',
584 'methodname' => 'get_users_courses',
585 'classpath' => 'enrol/externallib.php',
586 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_users_courses()',
587 'type' => 'read',
588 'capabilities'=> 'moodle/course:viewparticipants',
589 ),
590
591 'core_enrol_get_users_courses' => array(
592 'classname' => 'core_enrol_external',
593 'methodname' => 'get_users_courses',
594 'classpath' => 'enrol/externallib.php',
595 'description' => 'Get the list of courses where a user is enrolled in',
596 'type' => 'read',
597 'capabilities'=> 'moodle/course:viewparticipants',
598 ),
599
600 'core_enrol_get_course_enrolment_methods' => array(
601 'classname' => 'core_enrol_external',
602 'methodname' => 'get_course_enrolment_methods',
603 'classpath' => 'enrol/externallib.php',
604 'description' => 'Get the list of course enrolment methods',
605 'type' => 'read',
606 ),
607
608 // === Role related functions ===
609
610 'moodle_role_assign' => array(
611 'classname' => 'moodle_enrol_external',
612 'methodname' => 'role_assign',
613 'classpath' => 'enrol/externallib.php',
614 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()',
615 'type' => 'write',
616 'capabilities'=> 'moodle/role:assign',
617 ),
618
619 'core_role_assign_roles' => array(
620 'classname' => 'core_role_external',
621 'methodname' => 'assign_roles',
622 'classpath' => 'enrol/externallib.php',
623 'description' => 'Manual role assignments.',
624 'type' => 'write',
625 'capabilities'=> 'moodle/role:assign',
626 ),
627
628 'moodle_role_unassign' => array(
629 'classname' => 'moodle_enrol_external',
630 'methodname' => 'role_unassign',
631 'classpath' => 'enrol/externallib.php',
632 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()',
633 'type' => 'write',
634 'capabilities'=> 'moodle/role:assign',
635 ),
636
637 'core_role_unassign_roles' => array(
638 'classname' => 'core_role_external',
639 'methodname' => 'unassign_roles',
640 'classpath' => 'enrol/externallib.php',
641 'description' => 'Manual role unassignments.',
642 'type' => 'write',
643 'capabilities'=> 'moodle/role:assign',
644 ),
645
646 // === course related functions ===
647
648 'core_course_get_contents' => array(
649 'classname' => 'core_course_external',
650 'methodname' => 'get_course_contents',
651 'classpath' => 'course/externallib.php',
652 'description' => 'Get course contents',
653 'type' => 'read',
654 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
655 ),
656
657 'moodle_course_get_courses' => array(
658 'classname' => 'moodle_course_external',
659 'methodname' => 'get_courses',
660 'classpath' => 'course/externallib.php',
661 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()',
662 'type' => 'read',
663 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
664 ),
665
666 'core_course_get_courses' => array(
667 'classname' => 'core_course_external',
668 'methodname' => 'get_courses',
669 'classpath' => 'course/externallib.php',
670 'description' => 'Return course details',
671 'type' => 'read',
672 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
673 'ajax' => true,
674 ),
675
676 'core_course_search_courses' => array(
677 'classname' => 'core_course_external',
678 'methodname' => 'search_courses',
679 'classpath' => 'course/externallib.php',
680 'description' => 'Search courses by (name, module, block, tag)',
681 'type' => 'read',
682 'capabilities' => '',
683 'ajax' => true,
684 ),
685
686 'moodle_course_create_courses' => array(
687 'classname' => 'moodle_course_external',
688 'methodname' => 'create_courses',
689 'classpath' => 'course/externallib.php',
690 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()',
691 'type' => 'write',
692 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
693 ),
694
695 'core_course_create_courses' => array(
696 'classname' => 'core_course_external',
697 'methodname' => 'create_courses',
698 'classpath' => 'course/externallib.php',
699 'description' => 'Create new courses',
700 'type' => 'write',
701 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
702 ),
703
704 'core_course_delete_courses' => array(
705 'classname' => 'core_course_external',
706 'methodname' => 'delete_courses',
707 'classpath' => 'course/externallib.php',
708 'description' => 'Deletes all specified courses',
709 'type' => 'write',
710 'capabilities'=> 'moodle/course:delete',
711 ),
712
713 'core_course_delete_modules' => array(
714 'classname' => 'core_course_external',
715 'methodname' => 'delete_modules',
716 'classpath' => 'course/externallib.php',
717 'description' => 'Deletes all specified module instances',
718 'type' => 'write',
719 'capabilities' => 'moodle/course:manageactivities'
720 ),
721
722 'core_course_duplicate_course' => array(
723 'classname' => 'core_course_external',
724 'methodname' => 'duplicate_course',
725 'classpath' => 'course/externallib.php',
726 'description' => 'Duplicate an existing course (creating a new one) without user data',
727 'type' => 'write',
728 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
729 ),
730
731 'core_course_update_courses' => array(
732 'classname' => 'core_course_external',
733 'methodname' => 'update_courses',
734 'classpath' => 'course/externallib.php',
735 'description' => 'Update courses',
736 'type' => 'write',
737 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
738 ),
739
740 'core_course_view_course' => array(
741 'classname' => 'core_course_external',
742 'methodname' => 'view_course',
743 'classpath' => 'course/externallib.php',
744 'description' => 'Log that the course was viewed',
745 'type' => 'write'
746 ),
747
748 'core_course_get_course_module' => array(
749 'classname' => 'core_course_external',
750 'methodname' => 'get_course_module',
751 'classpath' => 'course/externallib.php',
752 'description' => 'Return information about a course module',
753 'type' => 'read'
754 ),
755
756 'core_course_get_course_module_by_instance' => array(
757 'classname' => 'core_course_external',
758 'methodname' => 'get_course_module_by_instance',
759 'classpath' => 'course/externallib.php',
760 'description' => 'Return information about a given module name and instance id',
761 'type' => 'read'
762 ),
763
764 // === course category related functions ===
765
766 'core_course_get_categories' => array(
767 'classname' => 'core_course_external',
768 'methodname' => 'get_categories',
769 'classpath' => 'course/externallib.php',
770 'description' => 'Return category details',
771 'type' => 'read',
772 'capabilities'=> 'moodle/category:viewhiddencategories',
773 ),
774
775 'core_course_create_categories' => array(
776 'classname' => 'core_course_external',
777 'methodname' => 'create_categories',
778 'classpath' => 'course/externallib.php',
779 'description' => 'Create course categories',
780 'type' => 'write',
781 'capabilities'=> 'moodle/category:manage',
782 ),
783
784 'core_course_update_categories' => array(
785 'classname' => 'core_course_external',
786 'methodname' => 'update_categories',
787 'classpath' => 'course/externallib.php',
788 'description' => 'Update categories',
789 'type' => 'write',
790 'capabilities'=> 'moodle/category:manage',
791 ),
792
793 'core_course_delete_categories' => array(
794 'classname' => 'core_course_external',
795 'methodname' => 'delete_categories',
796 'classpath' => 'course/externallib.php',
797 'description' => 'Delete course categories',
798 'type' => 'write',
799 'capabilities'=> 'moodle/category:manage',
800 ),
801
802 'core_course_import_course' => array(
803 'classname' => 'core_course_external',
804 'methodname' => 'import_course',
805 'classpath' => 'course/externallib.php',
806 'description' => 'Import course data from a course into another course. Does not include any user data.',
807 'type' => 'write',
808 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
809 ),
810
811 // === message related functions ===
812
813 'moodle_message_send_instantmessages' => array(
814 'classname' => 'moodle_message_external',
815 'methodname' => 'send_instantmessages',
816 'classpath' => 'message/externallib.php',
817 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_message_send_instant_messages()',
818 'type' => 'write',
819 'capabilities'=> 'moodle/site:sendmessage',
820 ),
821
822 'core_message_send_instant_messages' => array(
823 'classname' => 'core_message_external',
824 'methodname' => 'send_instant_messages',
825 'classpath' => 'message/externallib.php',
826 'description' => 'Send instant messages',
827 'type' => 'write',
828 'capabilities'=> 'moodle/site:sendmessage',
829 ),
830
831 'core_message_create_contacts' => array(
832 'classname' => 'core_message_external',
833 'methodname' => 'create_contacts',
834 'classpath' => 'message/externallib.php',
835 'description' => 'Add contacts to the contact list',
836 'type' => 'write',
837 'capabilities'=> '',
838 ),
839
840 'core_message_delete_contacts' => array(
841 'classname' => 'core_message_external',
842 'methodname' => 'delete_contacts',
843 'classpath' => 'message/externallib.php',
844 'description' => 'Remove contacts from the contact list',
845 'type' => 'write',
846 'capabilities'=> '',
847 ),
848
849 'core_message_block_contacts' => array(
850 'classname' => 'core_message_external',
851 'methodname' => 'block_contacts',
852 'classpath' => 'message/externallib.php',
853 'description' => 'Block contacts',
854 'type' => 'write',
855 'capabilities'=> '',
856 ),
857
858 'core_message_unblock_contacts' => array(
859 'classname' => 'core_message_external',
860 'methodname' => 'unblock_contacts',
861 'classpath' => 'message/externallib.php',
862 'description' => 'Unblock contacts',
863 'type' => 'write',
864 'capabilities'=> '',
865 ),
866
867 'core_message_get_contacts' => array(
868 'classname' => 'core_message_external',
869 'methodname' => 'get_contacts',
870 'classpath' => 'message/externallib.php',
871 'description' => 'Retrieve the contact list',
872 'type' => 'read',
873 'capabilities'=> '',
874 ),
875
876 'core_message_search_contacts' => array(
877 'classname' => 'core_message_external',
878 'methodname' => 'search_contacts',
879 'classpath' => 'message/externallib.php',
880 'description' => 'Search for contacts',
881 'type' => 'read',
882 'capabilities'=> '',
883 ),
884
885 'core_message_get_messages' => array(
886 'classname' => 'core_message_external',
887 'methodname' => 'get_messages',
888 'classpath' => 'message/externallib.php',
889 'description' => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)',
890 'type' => 'read',
891 'capabilities' => '',
892 ),
893
894 'core_message_get_blocked_users' => array(
895 'classname' => 'core_message_external',
896 'methodname' => 'get_blocked_users',
897 'classpath' => 'message/externallib.php',
898 'description' => 'Retrieve a list of users blocked',
899 'type' => 'read',
900 'capabilities' => '',
901 ),
902
903 'core_message_mark_message_read' => array(
904 'classname' => 'core_message_external',
905 'methodname' => 'mark_message_read',
906 'classpath' => 'message/externallib.php',
907 'description' => 'Mark a single message as read, trigger message_viewed event.',
908 'type' => 'write',
909 'capabilities' => '',
910 ),
911
912 'core_message_delete_message' => array(
913 'classname' => 'core_message_external',
914 'methodname' => 'delete_message',
915 'classpath' => 'message/externallib.php',
916 'description' => 'Deletes a message.',
917 'type' => 'write',
918 'capabilities' => 'moodle/site:deleteownmessage',
919 ),
920
921 // === notes related functions ===
922
923 'moodle_notes_create_notes' => array(
924 'classname' => 'moodle_notes_external',
925 'methodname' => 'create_notes',
926 'classpath' => 'notes/externallib.php',
927 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()',
928 'type' => 'write',
929 'capabilities'=> 'moodle/notes:manage',
930 ),
931
932 'core_notes_create_notes' => array(
933 'classname' => 'core_notes_external',
934 'methodname' => 'create_notes',
935 'classpath' => 'notes/externallib.php',
936 'description' => 'Create notes',
937 'type' => 'write',
938 'capabilities'=> 'moodle/notes:manage',
939 ),
940
941 'core_notes_delete_notes' => array(
942 'classname' => 'core_notes_external',
943 'methodname' => 'delete_notes',
944 'classpath' => 'notes/externallib.php',
945 'description' => 'Delete notes',
946 'type' => 'write',
947 'capabilities'=> 'moodle/notes:manage',
948 ),
949
950 'core_notes_get_notes' => array(
951 'classname' => 'core_notes_external',
952 'methodname' => 'get_notes',
953 'classpath' => 'notes/externallib.php',
954 'description' => 'Get notes',
955 'type' => 'read',
956 'capabilities'=> 'moodle/notes:view',
957 ),
958
959 'core_notes_update_notes' => array(
960 'classname' => 'core_notes_external',
961 'methodname' => 'update_notes',
962 'classpath' => 'notes/externallib.php',
963 'description' => 'Update notes',
964 'type' => 'write',
965 'capabilities'=> 'moodle/notes:manage',
966 ),
967
968 'core_notes_view_notes' => array(
969 'classname' => 'core_notes_external',
970 'methodname' => 'view_notes',
971 'classpath' => 'notes/externallib.php',
972 'description' => 'Simulates the web interface view of notes/index.php: trigger events.',
973 'type' => 'write',
974 'capabilities' => 'moodle/notes:view',
975 ),
976
977 // === grading related functions ===
978
979 'core_grading_get_definitions' => array(
980 'classname' => 'core_grading_external',
981 'methodname' => 'get_definitions',
982 'description' => 'Get grading definitions',
983 'type' => 'read'
984 ),
985
986 'core_grade_get_definitions' => array(
987 'classname' => 'core_grade_external',
988 'methodname' => 'get_definitions',
989 'classpath' => 'grade/externallib.php',
990 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()',
991 'type' => 'read'
992 ),
993
994 'core_grading_save_definitions' => array(
995 'classname' => 'core_grading_external',
996 'methodname' => 'save_definitions',
997 'description' => 'Save grading definitions',
998 'type' => 'write'
999 ),
1000
1001 'core_grading_get_gradingform_instances' => array(
1002 'classname' => 'core_grading_external',
1003 'methodname' => 'get_gradingform_instances',
1004 'description' => 'Get grading form instances',
1005 'type' => 'read'
1006 ),
1007
1008 // === webservice related functions ===
1009
1010 'moodle_webservice_get_siteinfo' => array(
1011 'classname' => 'moodle_webservice_external',
1012 'methodname' => 'get_siteinfo',
1013 'classpath' => 'webservice/externallib.php',
1014 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_webservice_get_site_info()',
1015 'type' => 'read',
1016 ),
1017
1018 'core_webservice_get_site_info' => array(
1019 'classname' => 'core_webservice_external',
1020 'methodname' => 'get_site_info',
1021 'classpath' => 'webservice/externallib.php',
1022 'description' => 'Return some site info / user info / list web service functions',
1023 'type' => 'read',
1024 ),
1025
1026 'core_get_string' => array(
1027 'classname' => 'core_external',
1028 'methodname' => 'get_string',
1029 'classpath' => 'lib/external/externallib.php',
1030 'description' => 'Return a translated string - similar to core get_string() call',
1031 'type' => 'read',
1032 'loginrequired' => false,
1033 'ajax' => true,
1034 ),
1035
1036 'core_get_strings' => array(
1037 'classname' => 'core_external',
1038 'methodname' => 'get_strings',
1039 'classpath' => 'lib/external/externallib.php',
1040 'description' => 'Return some translated strings - like several core get_string() calls',
1041 'type' => 'read',
1042 'loginrequired' => false,
1043 'ajax' => true,
1044 ),
1045
1046 'core_get_component_strings' => array(
1047 'classname' => 'core_external',
1048 'methodname' => 'get_component_strings',
1049 'classpath' => 'lib/external/externallib.php',
1050 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
1051 - similar to core get_component_strings() call',
1052 'type' => 'read',
1053 'loginrequired' => false,
1054 'ajax' => true,
1055 ),
1056
1057 'core_get_fragment' => array(
1058 'classname' => 'core_external',
1059 'methodname' => 'get_fragment',
1060 'classpath' => 'lib/external/externallib.php',
1061 'description' => 'Return a fragment for inclusion, such as a JavaScript page.',
1062 'type' => 'read',
1063 'ajax' => true,
1064 ),
1065
1066 'core_update_inplace_editable' => array(
1067 'classname' => 'core_external',
1068 'methodname' => 'update_inplace_editable',
1069 'classpath' => 'lib/external/externallib.php',
1070 'description' => 'Generic service to update title',
1071 'type' => 'write',
1072 'loginrequired' => true,
1073 'ajax' => true,
1074 ),
1075
1076 'core_fetch_notifications' => array(
1077 'classname' => 'core_external',
1078 'methodname' => 'fetch_notifications',
1079 'classpath' => 'lib/external/externallib.php',
1080 'description' => 'Return a list of notifications for the current session',
1081 'type' => 'read',
1082 'loginrequired' => false,
1083 'ajax' => true,
1084 ),
1085
1086 // === Calendar related functions ===
1087
1088 'core_calendar_delete_calendar_events' => array(
1089 'classname' => 'core_calendar_external',
1090 'methodname' => 'delete_calendar_events',
1091 'description' => 'Delete calendar events',
1092 'classpath' => 'calendar/externallib.php',
1093 'type' => 'write',
1094 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1095 ),
1096
1097
1098 'core_calendar_get_calendar_events' => array(
1099 'classname' => 'core_calendar_external',
1100 'methodname' => 'get_calendar_events',
1101 'description' => 'Get calendar events',
1102 'classpath' => 'calendar/externallib.php',
1103 'type' => 'read',
1104 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1105 ),
1106
1107 'core_calendar_create_calendar_events' => array(
1108 'classname' => 'core_calendar_external',
1109 'methodname' => 'create_calendar_events',
1110 'description' => 'Create calendar events',
1111 'classpath' => 'calendar/externallib.php',
1112 'type' => 'write',
1113 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1114 ),
1115
1116 'core_output_load_template' => array(
1117 'classname' => 'core\output\external',
1118 'methodname' => 'load_template',
1119 'description' => 'Load a template for a renderable',
1120 'type' => 'read',
1121 'loginrequired' => false,
1122 'ajax' => true,
1123 ),
1124
1125 // Completion related functions.
1126 'core_completion_update_activity_completion_status_manually' => array(
1127 'classname' => 'core_completion_external',
1128 'methodname' => 'update_activity_completion_status_manually',
1129 'description' => 'Update completion status for the current user in an activity, only for activities with manual tracking.',
1130 'type' => 'write',
1131 ),
1132
1133 'core_completion_mark_course_self_completed' => array(
1134 'classname' => 'core_completion_external',
1135 'methodname' => 'mark_course_self_completed',
1136 'description' => 'Update the course completion status for the current user (if course self-completion is enabled).',
1137 'type' => 'write',
1138 ),
1139
1140 'core_completion_get_activities_completion_status' => array(
1141 'classname' => 'core_completion_external',
1142 'methodname' => 'get_activities_completion_status',
1143 'description' => 'Return the activities completion status for a user in a course.',
1144 'type' => 'read',
1145 'capabilities' => '',
1146 ),
1147
1148 'core_completion_get_course_completion_status' => array(
1149 'classname' => 'core_completion_external',
1150 'methodname' => 'get_course_completion_status',
1151 'description' => 'Returns course completion status.',
1152 'type' => 'read',
1153 'capabilities' => 'report/completion:view',
1154 ),
1155
1156 // Rating functions.
1157 'core_rating_get_item_ratings' => array(
1158 'classname' => 'core_rating_external',
1159 'methodname' => 'get_item_ratings',
1160 'description' => 'Retrieve all the ratings for an item.',
1161 'type' => 'read',
1162 'capabilities' => 'moodle/rating:view'
1163 ),
1164
1165 // Tag functions.
1166 'core_tag_update_tags' => array(
1167 'classname' => 'core_tag_external',
1168 'methodname' => 'update_tags',
1169 'description' => 'Updates tags',
1170 'type' => 'write',
1171 'ajax' => true
1172 ),
1173
1174 'core_tag_get_tags' => array(
1175 'classname' => 'core_tag_external',
1176 'methodname' => 'get_tags',
1177 'description' => 'Gets tags by their ids',
1178 'type' => 'read',
1179 'ajax' => true
1180 ),
1181
1182 'core_tag_get_tagindex' => array(
1183 'classname' => 'core_tag_external',
1184 'methodname' => 'get_tagindex',
1185 'description' => 'Gets tag index page for one tag and one tag area',
1186 'type' => 'read',
1187 'ajax' => true
1188 ),
1189
1190 // Question related functions.
1191 'core_question_update_flag' => array(
1192 'classname' => 'core_question_external',
1193 'methodname' => 'update_flag',
1194 'description' => 'Update the flag state of a question attempt.',
1195 'type' => 'write',
1196 'capabilities' => 'moodle/question:flag',
1197 ),
1198
1199 // Badges functions.
1200 'core_badges_get_user_badges' => array(
1201 'classname' => 'core_badges_external',
1202 'methodname' => 'get_user_badges',
1203 'description' => 'Returns the list of badges awarded to a user.',
1204 'type' => 'read',
1205 'capabilities' => 'moodle/badges:viewotherbadges'
1206 ),
1207
1208);
1209
1210$services = array(
1211 'Moodle mobile web service' => array(
1212 'functions' => array (
1213 'moodle_enrol_get_users_courses',
1214 'moodle_enrol_get_enrolled_users',
1215 'moodle_user_get_users_by_id',
1216 'moodle_webservice_get_siteinfo',
1217 'moodle_notes_create_notes',
1218 'moodle_user_get_course_participants_by_id',
1219 'moodle_user_get_users_by_courseid',
1220 'moodle_message_send_instantmessages',
1221 'core_course_get_contents',
1222 'core_get_component_strings',
1223 'core_user_add_user_device',
1224 'core_calendar_get_calendar_events',
1225 'core_enrol_get_users_courses',
1226 'core_enrol_get_enrolled_users',
1227 'core_enrol_get_course_enrolment_methods',
1228 'enrol_guest_get_instance_info',
1229 'enrol_self_enrol_user',
1230 'enrol_self_get_instance_info',
1231 'core_user_get_users_by_id',
1232 'core_webservice_get_site_info',
1233 'core_notes_create_notes',
1234 'core_notes_delete_notes',
1235 'core_user_get_course_user_profiles',
1236 'core_message_send_instant_messages',
1237 'message_airnotifier_is_system_configured',
1238 'message_airnotifier_are_notification_preferences_configured',
1239 'core_grades_update_grades',
1240 'core_files_get_files',
1241 'core_message_get_messages',
1242 'core_message_create_contacts',
1243 'core_message_delete_contacts',
1244 'core_message_block_contacts',
1245 'core_message_unblock_contacts',
1246 'core_message_get_contacts',
1247 'core_message_search_contacts',
1248 'core_message_get_blocked_users',
1249 'gradereport_user_get_grades_table',
1250 'core_group_get_course_user_groups',
1251 'core_group_get_activity_allowed_groups',
1252 'core_group_get_activity_groupmode',
1253 'core_user_remove_user_device',
1254 'core_course_get_courses',
1255 'core_completion_update_activity_completion_status_manually',
1256 'core_completion_mark_course_self_completed',
1257 'core_comment_get_comments',
1258 'core_course_view_course',
1259 'core_course_search_courses',
1260 'core_course_get_course_module',
1261 'core_course_get_course_module_by_instance',
1262 'core_completion_get_activities_completion_status',
1263 'core_notes_get_course_notes',
1264 'core_completion_get_course_completion_status',
1265 'core_user_view_user_list',
1266 'core_message_mark_message_read',
1267 'core_message_delete_message',
1268 'core_notes_view_notes',
1269 'core_user_view_user_profile',
1270 'gradereport_user_view_grade_report',
1271 'core_rating_get_item_ratings',
1272 'core_user_get_users_by_field',
1273 'core_user_add_user_private_files',
1274 'core_question_update_flag',
1275 'core_badges_get_user_badges',
1276 ),
1277 'enabled' => 0,
1278 'restrictedusers' => 0,
1279 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
1280 'downloadfiles' => 1,
1281 'uploadfiles' => 1
1282 ),
1283);