MDL-49163 Webservices, AJAX: Add support for a new ajax webservice handler.
[moodle.git] / lib / db / services.php
CommitLineData
9a0df45a 1<?php
9a0df45a 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
a0a07014 17
9a0df45a 18/**
19 * Core external functions and service definitions.
20 *
39b90b51
EL
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 *
a0a07014
JM
30 * @package core_webservice
31 * @category webservice
32 * @copyright 2009 Petr Skodak
9a0df45a 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34 */
35
36$functions = array(
ef22c1b6 37
088645e2
AB
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 ),
198e802f 102 // Grade related functions.
d3549931 103
198e802f
JL
104 'core_grades_get_grades' => array(
105 'classname' => 'core_grades_external',
106 'methodname' => 'get_grades',
a0095e5a
JL
107 'description' => 'Returns student course total grade and grades for activities.
108 This function does not return category or manual items.
109 This function is suitable for managers or teachers not students.',
198e802f 110 'type' => 'read',
a0095e5a 111 'capabilities' => 'moodle/grade:view, moodle/grade:viewall, moodle/grade:viewhidden',
d3549931
AD
112 ),
113
198e802f
JL
114 'core_grades_update_grades' => array(
115 'classname' => 'core_grades_external',
116 'methodname' => 'update_grades',
198e802f
JL
117 'description' => 'Update a grade item and associated student grades.',
118 'type' => 'write',
119 'capabilities' => '',
d3549931 120 ),
088645e2 121
ef22c1b6 122 // === group related functions ===
f5072177 123
9a0df45a 124 'moodle_group_create_groups' => array(
3c1aa6fd 125 'classname' => 'moodle_group_external',
5d1017e1
JM
126 'methodname' => 'create_groups',
127 'classpath' => 'group/externallib.php',
3c1aa6fd 128 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_create_groups(). ',
5d1017e1
JM
129 'type' => 'write',
130 'capabilities'=> 'moodle/course:managegroups',
131 ),
132
133 'core_group_create_groups' => array(
134 'classname' => 'core_group_external',
9a0df45a 135 'methodname' => 'create_groups',
136 'classpath' => 'group/externallib.php',
f5072177 137 'description' => 'Creates new groups.',
138 'type' => 'write',
72f68b51 139 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 140 ),
f5072177 141
9a0df45a 142 'moodle_group_get_groups' => array(
3c1aa6fd 143 'classname' => 'moodle_group_external',
5d1017e1
JM
144 'methodname' => 'get_groups',
145 'classpath' => 'group/externallib.php',
3c1aa6fd 146 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_groups()',
5d1017e1
JM
147 'type' => 'read',
148 'capabilities'=> 'moodle/course:managegroups',
149 ),
150
151 'core_group_get_groups' => array(
152 'classname' => 'core_group_external',
9a0df45a 153 'methodname' => 'get_groups',
154 'classpath' => 'group/externallib.php',
cfb99b75 155 'description' => 'Returns group details.',
f5072177 156 'type' => 'read',
72f68b51 157 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 158 ),
246f6da2 159
160 'moodle_group_get_course_groups' => array(
3c1aa6fd 161 'classname' => 'moodle_group_external',
5d1017e1
JM
162 'methodname' => 'get_course_groups',
163 'classpath' => 'group/externallib.php',
3c1aa6fd 164 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_course_groups()',
5d1017e1
JM
165 'type' => 'read',
166 'capabilities'=> 'moodle/course:managegroups',
167 ),
168
169 'core_group_get_course_groups' => array(
170 'classname' => 'core_group_external',
246f6da2 171 'methodname' => 'get_course_groups',
172 'classpath' => 'group/externallib.php',
173 'description' => 'Returns all groups in specified course.',
174 'type' => 'read',
72f68b51 175 'capabilities'=> 'moodle/course:managegroups',
246f6da2 176 ),
2cb1ee78 177
9a0df45a 178 'moodle_group_delete_groups' => array(
3c1aa6fd 179 'classname' => 'moodle_group_external',
5d1017e1
JM
180 'methodname' => 'delete_groups',
181 'classpath' => 'group/externallib.php',
3c1aa6fd 182 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_groups()',
5d1017e1
JM
183 'type' => 'delete',
184 'capabilities'=> 'moodle/course:managegroups',
185 ),
186
187 'core_group_delete_groups' => array(
188 'classname' => 'core_group_external',
9a0df45a 189 'methodname' => 'delete_groups',
190 'classpath' => 'group/externallib.php',
0f4e72de
PS
191 'description' => 'Deletes all specified groups.',
192 'type' => 'delete',
72f68b51 193 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 194 ),
c863dc38 195
9a0df45a 196 'moodle_group_get_groupmembers' => array(
3c1aa6fd
DM
197 'classname' => 'moodle_group_external',
198 'methodname' => 'get_groupmembers',
5d1017e1 199 'classpath' => 'group/externallib.php',
3c1aa6fd 200 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_group_members()',
5d1017e1
JM
201 'type' => 'read',
202 'capabilities'=> 'moodle/course:managegroups',
203 ),
204
205 'core_group_get_group_members' => array(
206 'classname' => 'core_group_external',
207 'methodname' => 'get_group_members',
9a0df45a 208 'classpath' => 'group/externallib.php',
0f4e72de
PS
209 'description' => 'Returns group members.',
210 'type' => 'read',
72f68b51 211 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 212 ),
4efa2483 213
9a0df45a 214 'moodle_group_add_groupmembers' => array(
3c1aa6fd
DM
215 'classname' => 'moodle_group_external',
216 'methodname' => 'add_groupmembers',
5d1017e1 217 'classpath' => 'group/externallib.php',
3c1aa6fd 218 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_add_group_members()',
5d1017e1
JM
219 'type' => 'write',
220 'capabilities'=> 'moodle/course:managegroups',
221 ),
222
223 'core_group_add_group_members' => array(
224 'classname' => 'core_group_external',
225 'methodname' => 'add_group_members',
9a0df45a 226 'classpath' => 'group/externallib.php',
0f4e72de
PS
227 'description' => 'Adds group members.',
228 'type' => 'write',
72f68b51 229 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 230 ),
231
232 'moodle_group_delete_groupmembers' => array(
3c1aa6fd
DM
233 'classname' => 'moodle_group_external',
234 'methodname' => 'delete_groupmembers',
9a0df45a 235 'classpath' => 'group/externallib.php',
3c1aa6fd 236 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_group_members()',
0f4e72de 237 'type' => 'delete',
72f68b51 238 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 239 ),
72f68b51 240
5d1017e1
JM
241 'core_group_delete_group_members' => array(
242 'classname' => 'core_group_external',
243 'methodname' => 'delete_group_members',
244 'classpath' => 'group/externallib.php',
245 'description' => 'Deletes group members.',
246 'type' => 'delete',
247 'capabilities'=> 'moodle/course:managegroups',
248 ),
72f68b51 249
7ce23590
JL
250 'core_group_create_groupings' => array(
251 'classname' => 'core_group_external',
252 'methodname' => 'create_groupings',
253 'classpath' => 'group/externallib.php',
254 'description' => 'Creates new groupings',
255 'type' => 'write',
256 ),
257
258 'core_group_update_groupings' => array(
259 'classname' => 'core_group_external',
260 'methodname' => 'update_groupings',
261 'classpath' => 'group/externallib.php',
262 'description' => 'Updates existing groupings',
263 'type' => 'write',
264 ),
265
266 'core_group_get_groupings' => array(
267 'classname' => 'core_group_external',
268 'methodname' => 'get_groupings',
269 'classpath' => 'group/externallib.php',
270 'description' => 'Returns groupings details.',
271 'type' => 'read',
272 ),
273
274 'core_group_get_course_groupings' => array(
67aa60f9
JL
275 'classname' => 'core_group_external',
276 'methodname' => 'get_course_groupings',
277 'classpath' => 'group/externallib.php',
278 'description' => 'Returns all groupings in specified course.',
279 'type' => 'read',
7ce23590
JL
280 ),
281
282 'core_group_delete_groupings' => array(
67aa60f9
JL
283 'classname' => 'core_group_external',
284 'methodname' => 'delete_groupings',
285 'classpath' => 'group/externallib.php',
286 'description' => 'Deletes all specified groupings.',
287 'type' => 'write',
7ce23590
JL
288 ),
289
290 'core_group_assign_grouping' => array(
67aa60f9
JL
291 'classname' => 'core_group_external',
292 'methodname' => 'assign_grouping',
293 'classpath' => 'group/externallib.php',
294 'description' => 'Assing groups from groupings',
295 'type' => 'write',
7ce23590
JL
296 ),
297
298 'core_group_unassign_grouping' => array(
67aa60f9
JL
299 'classname' => 'core_group_external',
300 'methodname' => 'unassign_grouping',
301 'classpath' => 'group/externallib.php',
302 'description' => 'Unassing groups from groupings',
303 'type' => 'write',
7ce23590
JL
304 ),
305
5d62e813
JL
306 'core_group_get_course_user_groups' => array(
307 'classname' => 'core_group_external',
308 'methodname' => 'get_course_user_groups',
309 'classpath' => 'group/externallib.php',
310 'description' => 'Returns all groups in specified course for the specified user.',
311 'type' => 'read',
312 'capabilities' => 'moodle/course:managegroups',
313 ),
314
72f68b51 315 // === file related functions ===
316
249c4f60 317 'moodle_file_get_files' => array(
3c1aa6fd 318 'classname' => 'moodle_file_external',
5d1017e1 319 'methodname' => 'get_files',
3c1aa6fd 320 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_get_files()',
5d1017e1
JM
321 'type' => 'read',
322 'classpath' => 'files/externallib.php',
323 ),
324
325 'core_files_get_files' => array(
326 'classname' => 'core_files_external',
249c4f60
DC
327 'methodname' => 'get_files',
328 'description' => 'browse moodle files',
329 'type' => 'read',
330 'classpath' => 'files/externallib.php',
331 ),
5d1017e1 332
249c4f60 333 'moodle_file_upload' => array(
3c1aa6fd 334 'classname' => 'moodle_file_external',
5d1017e1 335 'methodname' => 'upload',
3c1aa6fd 336 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_upload()',
5d1017e1
JM
337 'type' => 'write',
338 'classpath' => 'files/externallib.php',
339 ),
340
341 'core_files_upload' => array(
342 'classname' => 'core_files_external',
249c4f60
DC
343 'methodname' => 'upload',
344 'description' => 'upload a file to moodle',
345 'type' => 'write',
346 'classpath' => 'files/externallib.php',
347 ),
4efa2483 348
ef22c1b6 349 // === user related functions ===
72f68b51 350
ef22c1b6 351 'moodle_user_create_users' => array(
3c1aa6fd 352 'classname' => 'moodle_user_external',
5d1017e1
JM
353 'methodname' => 'create_users',
354 'classpath' => 'user/externallib.php',
3c1aa6fd 355 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_create_users()',
5d1017e1
JM
356 'type' => 'write',
357 'capabilities'=> 'moodle/user:create',
358 ),
359
360 'core_user_create_users' => array(
361 'classname' => 'core_user_external',
ef22c1b6 362 'methodname' => 'create_users',
363 'classpath' => 'user/externallib.php',
fb79269b 364 'description' => 'Create users.',
365 'type' => 'write',
72f68b51 366 'capabilities'=> 'moodle/user:create',
ef22c1b6 367 ),
368
b0365ea5
JM
369 'core_user_get_users' => array(
370 'classname' => 'core_user_external',
371 'methodname' => 'get_users',
372 'classpath' => 'user/externallib.php',
373 'description' => 'search for users matching the parameters',
374 'type' => 'read',
375 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
376 ),
377
fb79269b 378 'moodle_user_get_users_by_id' => array(
3c1aa6fd 379 'classname' => 'moodle_user_external',
5d1017e1
JM
380 'methodname' => 'get_users_by_id',
381 'classpath' => 'user/externallib.php',
3c1aa6fd 382 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. Use core_user_get_users_by_field service instead',
5d1017e1
JM
383 'type' => 'read',
384 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
385 ),
386
c70b9853 387 'core_user_get_users_by_field' => array(
86477112 388 'classname' => 'core_user_external',
c70b9853 389 'methodname' => 'get_users_by_field',
86477112 390 'classpath' => 'user/externallib.php',
c70b9853 391 'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()',
86477112
FS
392 'type' => 'read',
393 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
394 ),
395
5d1017e1
JM
396 'core_user_get_users_by_id' => array(
397 'classname' => 'core_user_external',
fb79269b 398 'methodname' => 'get_users_by_id',
ef22c1b6 399 'classpath' => 'user/externallib.php',
41f5285f 400 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been replaced by core_user_get_users_by_field()',
fb79269b 401 'type' => 'read',
b4c74367 402 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
ef22c1b6 403 ),
404
01479290 405 'moodle_user_get_users_by_courseid' => array(
3c1aa6fd
DM
406 'classname' => 'moodle_user_external',
407 'methodname' => 'get_users_by_courseid',
408 'classpath' => 'user/externallib.php',
409 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_enrolled_users()',
01479290
DC
410 'type' => 'read',
411 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
412 ),
413
ea4e96c2 414 'moodle_user_get_course_participants_by_id' => array(
3c1aa6fd
DM
415 'classname' => 'moodle_user_external',
416 'methodname' => 'get_course_participants_by_id',
ea4e96c2 417 'classpath' => 'user/externallib.php',
3c1aa6fd 418 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_get_course_user_profiles()',
5d1017e1
JM
419 'type' => 'read',
420 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
421 ),
422
423 'core_user_get_course_user_profiles' => array(
424 'classname' => 'core_user_external',
425 'methodname' => 'get_course_user_profiles',
426 'classpath' => 'user/externallib.php',
427 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
ea4e96c2
DC
428 'type' => 'read',
429 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
430 ),
431
ef22c1b6 432 'moodle_user_delete_users' => array(
3c1aa6fd 433 'classname' => 'moodle_user_external',
5d1017e1
JM
434 'methodname' => 'delete_users',
435 'classpath' => 'user/externallib.php',
3c1aa6fd 436 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_delete_users()',
5d1017e1
JM
437 'type' => 'write',
438 'capabilities'=> 'moodle/user:delete',
439 ),
440
441 'core_user_delete_users' => array(
442 'classname' => 'core_user_external',
ef22c1b6 443 'methodname' => 'delete_users',
444 'classpath' => 'user/externallib.php',
fb79269b 445 'description' => 'Delete users.',
446 'type' => 'write',
72f68b51 447 'capabilities'=> 'moodle/user:delete',
ef22c1b6 448 ),
449
450 'moodle_user_update_users' => array(
3c1aa6fd 451 'classname' => 'moodle_user_external',
5d1017e1
JM
452 'methodname' => 'update_users',
453 'classpath' => 'user/externallib.php',
3c1aa6fd 454 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_update_users()',
5d1017e1
JM
455 'type' => 'write',
456 'capabilities'=> 'moodle/user:update',
457 ),
458
459 'core_user_update_users' => array(
460 'classname' => 'core_user_external',
ef22c1b6 461 'methodname' => 'update_users',
462 'classpath' => 'user/externallib.php',
fb79269b 463 'description' => 'Update users.',
464 'type' => 'write',
72f68b51 465 'capabilities'=> 'moodle/user:update',
ef22c1b6 466 ),
e9b66095 467
6a403810
JL
468 'core_user_add_user_device' => array(
469 'classname' => 'core_user_external',
470 'methodname' => 'add_user_device',
471 'classpath' => 'user/externallib.php',
472 'description' => 'Store mobile user devices information for PUSH Notifications.',
473 'type' => 'write',
474 'capabilities'=> '',
475 ),
476
3221718e
JL
477 'core_user_remove_user_device' => array(
478 'classname' => 'core_user_external',
479 'methodname' => 'remove_user_device',
480 'classpath' => 'user/externallib.php',
481 'description' => 'Remove a user device from the Moodle database.',
482 'type' => 'write',
483 'capabilities' => '',
484 ),
485
72f68b51 486 // === enrol related functions ===
d0068cd0 487
b6b6c7ac
PC
488 'core_enrol_get_enrolled_users_with_capability' => array(
489 'classname' => 'core_enrol_external',
490 'methodname' => 'get_enrolled_users_with_capability',
491 'classpath' => 'enrol/externallib.php',
492 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
493 and have that capability',
494 'type' => 'read',
495 ),
72f68b51 496
df997f84
PS
497 'moodle_enrol_get_enrolled_users' => array(
498 'classname' => 'moodle_enrol_external',
499 'methodname' => 'get_enrolled_users',
500 'classpath' => 'enrol/externallib.php',
5d1017e1 501 '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).',
df997f84 502 'type' => 'read',
72f68b51 503 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
504 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84 505 ),
e6acc551 506
5d1017e1
JM
507 'core_enrol_get_enrolled_users' => array(
508 'classname' => 'core_enrol_external',
509 'methodname' => 'get_enrolled_users',
510 'classpath' => 'enrol/externallib.php',
511 'description' => 'Get enrolled users by course id.',
512 'type' => 'read',
513 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
514 ),
df997f84 515
3364dbb5 516 'moodle_enrol_get_users_courses' => array(
3c1aa6fd 517 'classname' => 'moodle_enrol_external',
3364dbb5
PS
518 'methodname' => 'get_users_courses',
519 'classpath' => 'enrol/externallib.php',
3c1aa6fd 520 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_users_courses()',
3364dbb5
PS
521 'type' => 'read',
522 'capabilities'=> 'moodle/course:viewparticipants',
523 ),
524
5d1017e1
JM
525 'core_enrol_get_users_courses' => array(
526 'classname' => 'core_enrol_external',
527 'methodname' => 'get_users_courses',
528 'classpath' => 'enrol/externallib.php',
529 'description' => 'Get the list of courses where a user is enrolled in',
530 'type' => 'read',
531 'capabilities'=> 'moodle/course:viewparticipants',
532 ),
533
be9bf94e
RT
534 'core_enrol_get_course_enrolment_methods' => array(
535 'classname' => 'core_enrol_external',
536 'methodname' => 'get_course_enrolment_methods',
537 'classpath' => 'enrol/externallib.php',
538 'description' => 'Get the list of course enrolment methods',
539 'type' => 'read',
540 ),
541
5d1017e1
JM
542 // === Role related functions ===
543
df997f84 544 'moodle_role_assign' => array(
3c1aa6fd
DM
545 'classname' => 'moodle_enrol_external',
546 'methodname' => 'role_assign',
5d1017e1 547 'classpath' => 'enrol/externallib.php',
3c1aa6fd 548 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()',
5d1017e1
JM
549 'type' => 'write',
550 'capabilities'=> 'moodle/role:assign',
551 ),
552
553 'core_role_assign_roles' => array(
554 'classname' => 'core_role_external',
555 'methodname' => 'assign_roles',
e9b66095 556 'classpath' => 'enrol/externallib.php',
df997f84 557 'description' => 'Manual role assignments.',
e9b66095 558 'type' => 'write',
72f68b51 559 'capabilities'=> 'moodle/role:assign',
e9b66095 560 ),
561
df997f84 562 'moodle_role_unassign' => array(
3c1aa6fd
DM
563 'classname' => 'moodle_enrol_external',
564 'methodname' => 'role_unassign',
5d1017e1 565 'classpath' => 'enrol/externallib.php',
3c1aa6fd 566 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()',
5d1017e1
JM
567 'type' => 'write',
568 'capabilities'=> 'moodle/role:assign',
569 ),
570
571 'core_role_unassign_roles' => array(
572 'classname' => 'core_role_external',
573 'methodname' => 'unassign_roles',
e9b66095 574 'classpath' => 'enrol/externallib.php',
df997f84 575 'description' => 'Manual role unassignments.',
e9b66095 576 'type' => 'write',
72f68b51 577 'capabilities'=> 'moodle/role:assign',
e9b66095 578 ),
5b4a78e2 579
6bb31e40 580 // === course related functions ===
581
3ec163dd 582 'core_course_get_contents' => array(
d4a246bc 583 'classname' => 'core_course_external',
3ec163dd 584 'methodname' => 'get_course_contents',
d4a246bc 585 'classpath' => 'course/externallib.php',
3ec163dd 586 'description' => 'Get course contents',
d4a246bc 587 'type' => 'read',
3ec163dd 588 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
f2229c68 589 ),
d6ebe011 590
6bb31e40 591 'moodle_course_get_courses' => array(
3c1aa6fd 592 'classname' => 'moodle_course_external',
5d1017e1
JM
593 'methodname' => 'get_courses',
594 'classpath' => 'course/externallib.php',
3c1aa6fd 595 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()',
5d1017e1
JM
596 'type' => 'read',
597 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
598 ),
599
600 'core_course_get_courses' => array(
601 'classname' => 'core_course_external',
6bb31e40 602 'methodname' => 'get_courses',
603 'classpath' => 'course/externallib.php',
604 'description' => 'Return course details',
605 'type' => 'read',
606 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
607 ),
608
609 'moodle_course_create_courses' => array(
3c1aa6fd 610 'classname' => 'moodle_course_external',
5d1017e1
JM
611 'methodname' => 'create_courses',
612 'classpath' => 'course/externallib.php',
3c1aa6fd 613 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()',
5d1017e1
JM
614 'type' => 'write',
615 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
616 ),
617
618 'core_course_create_courses' => array(
619 'classname' => 'core_course_external',
6bb31e40 620 'methodname' => 'create_courses',
621 'classpath' => 'course/externallib.php',
622 'description' => 'Create new courses',
623 'type' => 'write',
624 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
625 ),
626
63a85dc7
JL
627 'core_course_delete_courses' => array(
628 'classname' => 'core_course_external',
629 'methodname' => 'delete_courses',
630 'classpath' => 'course/externallib.php',
631 'description' => 'Deletes all specified courses',
632 'type' => 'write',
633 'capabilities'=> 'moodle/course:delete',
634 ),
635
79949c1b
MN
636 'core_course_delete_modules' => array(
637 'classname' => 'core_course_external',
638 'methodname' => 'delete_modules',
639 'classpath' => 'course/externallib.php',
640 'description' => 'Deletes all specified module instances',
641 'type' => 'write',
642 'capabilities' => 'moodle/course:manageactivities'
643 ),
644
3dc1d76e
JL
645 'core_course_duplicate_course' => array(
646 'classname' => 'core_course_external',
647 'methodname' => 'duplicate_course',
648 'classpath' => 'course/externallib.php',
649 'description' => 'Duplicate an existing course (creating a new one) without user data',
650 'type' => 'write',
651 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
652 ),
653
791723c3
RT
654 'core_course_update_courses' => array(
655 'classname' => 'core_course_external',
656 'methodname' => 'update_courses',
657 'classpath' => 'course/externallib.php',
658 'description' => 'Update courses',
659 'type' => 'write',
660 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
661 ),
662
3ec163dd
EL
663 // === course category related functions ===
664
665 'core_course_get_categories' => array(
666 'classname' => 'core_course_external',
667 'methodname' => 'get_categories',
668 'classpath' => 'course/externallib.php',
669 'description' => 'Return category details',
670 'type' => 'read',
671 'capabilities'=> 'moodle/category:viewhiddencategories',
672 ),
673
479a5db1
FS
674 'core_course_create_categories' => array(
675 'classname' => 'core_course_external',
676 'methodname' => 'create_categories',
677 'classpath' => 'course/externallib.php',
678 'description' => 'Create course categories',
679 'type' => 'write',
680 'capabilities'=> 'moodle/category:manage',
681 ),
d6ebe011 682
3ec163dd
EL
683 'core_course_update_categories' => array(
684 'classname' => 'core_course_external',
685 'methodname' => 'update_categories',
686 'classpath' => 'course/externallib.php',
687 'description' => 'Update categories',
688 'type' => 'write',
afe27edc 689 'capabilities'=> 'moodle/category:manage',
3ec163dd
EL
690 ),
691
2f951d86
FS
692 'core_course_delete_categories' => array(
693 'classname' => 'core_course_external',
694 'methodname' => 'delete_categories',
695 'classpath' => 'course/externallib.php',
696 'description' => 'Delete course categories',
697 'type' => 'write',
698 'capabilities'=> 'moodle/category:manage',
699 ),
479a5db1 700
8430d87b
JL
701 'core_course_import_course' => array(
702 'classname' => 'core_course_external',
703 'methodname' => 'import_course',
704 'classpath' => 'course/externallib.php',
705 'description' => 'Import course data from a course into another course. Does not include any user data.',
706 'type' => 'write',
707 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
708 ),
709
a623b6b8
JM
710 // === message related functions ===
711
4de00da7 712 'moodle_message_send_instantmessages' => array(
3c1aa6fd
DM
713 'classname' => 'moodle_message_external',
714 'methodname' => 'send_instantmessages',
5d1017e1 715 'classpath' => 'message/externallib.php',
3c1aa6fd 716 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_message_send_instant_messages()',
5d1017e1
JM
717 'type' => 'write',
718 'capabilities'=> 'moodle/site:sendmessage',
719 ),
720
721 'core_message_send_instant_messages' => array(
722 'classname' => 'core_message_external',
723 'methodname' => 'send_instant_messages',
a623b6b8 724 'classpath' => 'message/externallib.php',
4de00da7 725 'description' => 'Send instant messages',
a623b6b8
JM
726 'type' => 'write',
727 'capabilities'=> 'moodle/site:sendmessage',
728 ),
729
d6731600
FM
730 'core_message_create_contacts' => array(
731 'classname' => 'core_message_external',
732 'methodname' => 'create_contacts',
733 'classpath' => 'message/externallib.php',
734 'description' => 'Add contacts to the contact list',
735 'type' => 'write',
736 'capabilities'=> '',
737 ),
738
739 'core_message_delete_contacts' => array(
740 'classname' => 'core_message_external',
741 'methodname' => 'delete_contacts',
742 'classpath' => 'message/externallib.php',
743 'description' => 'Remove contacts from the contact list',
744 'type' => 'write',
745 'capabilities'=> '',
746 ),
747
748 'core_message_block_contacts' => array(
749 'classname' => 'core_message_external',
750 'methodname' => 'block_contacts',
751 'classpath' => 'message/externallib.php',
752 'description' => 'Block contacts',
753 'type' => 'write',
754 'capabilities'=> '',
755 ),
756
757 'core_message_unblock_contacts' => array(
758 'classname' => 'core_message_external',
759 'methodname' => 'unblock_contacts',
760 'classpath' => 'message/externallib.php',
761 'description' => 'Unblock contacts',
762 'type' => 'write',
763 'capabilities'=> '',
764 ),
765
766 'core_message_get_contacts' => array(
767 'classname' => 'core_message_external',
768 'methodname' => 'get_contacts',
769 'classpath' => 'message/externallib.php',
770 'description' => 'Retrieve the contact list',
771 'type' => 'read',
772 'capabilities'=> '',
773 ),
774
775 'core_message_search_contacts' => array(
776 'classname' => 'core_message_external',
777 'methodname' => 'search_contacts',
778 'classpath' => 'message/externallib.php',
779 'description' => 'Search for contacts',
780 'type' => 'read',
781 'capabilities'=> '',
782 ),
783
aff9da17 784 'core_message_get_messages' => array(
6ff4464b
JL
785 'classname' => 'core_message_external',
786 'methodname' => 'get_messages',
787 'classpath' => 'message/externallib.php',
127ef540 788 'description' => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)',
6ff4464b
JL
789 'type' => 'read',
790 'capabilities' => '',
aff9da17
JL
791 ),
792
60ab2e1b
JL
793 'core_message_get_blocked_users' => array(
794 'classname' => 'core_message_external',
795 'methodname' => 'get_blocked_users',
796 'classpath' => 'message/externallib.php',
797 'description' => 'Retrieve a list of users blocked',
798 'type' => 'read',
799 'capabilities' => '',
800 ),
801
8d46dabb
JM
802 // === notes related functions ===
803
804 'moodle_notes_create_notes' => array(
3c1aa6fd 805 'classname' => 'moodle_notes_external',
5d1017e1
JM
806 'methodname' => 'create_notes',
807 'classpath' => 'notes/externallib.php',
3c1aa6fd 808 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()',
5d1017e1
JM
809 'type' => 'write',
810 'capabilities'=> 'moodle/notes:manage',
811 ),
812
813 'core_notes_create_notes' => array(
814 'classname' => 'core_notes_external',
8d46dabb
JM
815 'methodname' => 'create_notes',
816 'classpath' => 'notes/externallib.php',
817 'description' => 'Create notes',
818 'type' => 'write',
819 'capabilities'=> 'moodle/notes:manage',
820 ),
821
34348b2b
JF
822 'core_notes_delete_notes' => array(
823 'classname' => 'core_notes_external',
824 'methodname' => 'delete_notes',
825 'classpath' => 'notes/externallib.php',
826 'description' => 'Delete notes',
827 'type' => 'write',
828 'capabilities'=> 'moodle/notes:manage',
829 ),
830
831 'core_notes_get_notes' => array(
832 'classname' => 'core_notes_external',
833 'methodname' => 'get_notes',
834 'classpath' => 'notes/externallib.php',
835 'description' => 'Get notes',
836 'type' => 'read',
837 'capabilities'=> 'moodle/notes:view',
838 ),
839
840 'core_notes_update_notes' => array(
841 'classname' => 'core_notes_external',
842 'methodname' => 'update_notes',
843 'classpath' => 'notes/externallib.php',
844 'description' => 'Update notes',
845 'type' => 'write',
846 'capabilities'=> 'moodle/notes:manage',
847 ),
848
9028d9b5
PC
849 // === grading related functions ===
850
851 'core_grading_get_definitions' => array(
852 'classname' => 'core_grading_external',
853 'methodname' => 'get_definitions',
9028d9b5
PC
854 'description' => 'Get grading definitions',
855 'type' => 'read'
856 ),
3f0ea6d8
PC
857
858 'core_grade_get_definitions' => array(
859 'classname' => 'core_grade_external',
860 'methodname' => 'get_definitions',
861 'classpath' => 'grade/externallib.php',
9028d9b5
PC
862 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()',
863 'type' => 'read'
864 ),
865
0ff4ebb4
PC
866 'core_grading_save_definitions' => array(
867 'classname' => 'core_grading_external',
868 'methodname' => 'save_definitions',
869 'description' => 'Save grading definitions',
870 'type' => 'write'
871 ),
872
9028d9b5
PC
873 'core_grading_get_gradingform_instances' => array(
874 'classname' => 'core_grading_external',
875 'methodname' => 'get_gradingform_instances',
9028d9b5 876 'description' => 'Get grading form instances',
3f0ea6d8
PC
877 'type' => 'read'
878 ),
879
0bf486a6
JM
880 // === webservice related functions ===
881
882 'moodle_webservice_get_siteinfo' => array(
3c1aa6fd
DM
883 'classname' => 'moodle_webservice_external',
884 'methodname' => 'get_siteinfo',
5d1017e1 885 'classpath' => 'webservice/externallib.php',
3c1aa6fd 886 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_webservice_get_site_info()',
5d1017e1
JM
887 'type' => 'read',
888 ),
889
890 'core_webservice_get_site_info' => array(
891 'classname' => 'core_webservice_external',
892 'methodname' => 'get_site_info',
0bf486a6
JM
893 'classpath' => 'webservice/externallib.php',
894 'description' => 'Return some site info / user info / list web service functions',
895 'type' => 'read',
896 ),
897
11e76602
JM
898 'core_get_string' => array(
899 'classname' => 'core_external',
900 'methodname' => 'get_string',
901 'classpath' => 'lib/external/externallib.php',
902 'description' => 'Return a translated string - similar to core get_string() call',
903 'type' => 'read',
904 ),
905
906 'core_get_strings' => array(
907 'classname' => 'core_external',
908 'methodname' => 'get_strings',
909 'classpath' => 'lib/external/externallib.php',
910 'description' => 'Return some translated strings - like several core get_string() calls',
911 'type' => 'read',
912 ),
913
914 'core_get_component_strings' => array(
915 'classname' => 'core_external',
916 'methodname' => 'get_component_strings',
917 'classpath' => 'lib/external/externallib.php',
918 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
919 - similar to core get_component_strings() call',
920 'type' => 'read',
921 ),
5e1350ab
AA
922
923
924 // === Calendar related functions ===
925
926 'core_calendar_delete_calendar_events' => array(
927 'classname' => 'core_calendar_external',
928 'methodname' => 'delete_calendar_events',
929 'description' => 'Delete calendar events',
930 'classpath' => 'calendar/externallib.php',
931 'type' => 'write',
932 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
933 ),
934
793d3855
AA
935
936 'core_calendar_get_calendar_events' => array(
937 'classname' => 'core_calendar_external',
938 'methodname' => 'get_calendar_events',
939 'description' => 'Get calendar events',
940 'classpath' => 'calendar/externallib.php',
941 'type' => 'read',
942 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
943 ),
944
c66dc3df
AA
945 'core_calendar_create_calendar_events' => array(
946 'classname' => 'core_calendar_external',
947 'methodname' => 'create_calendar_events',
948 'description' => 'Create calendar events',
949 'classpath' => 'calendar/externallib.php',
950 'type' => 'write',
951 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
952 ),
9a0df45a 953);
c1b65883
JM
954
955$services = array(
96e0194c
SH
956 'Moodle mobile web service' => array(
957 'functions' => array (
958 'moodle_enrol_get_users_courses',
959 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
960 'moodle_user_get_users_by_id',
961 'moodle_webservice_get_siteinfo',
962 'moodle_notes_create_notes',
ea4e96c2 963 'moodle_user_get_course_participants_by_id',
01479290 964 'moodle_user_get_users_by_courseid',
ec0d6ea2 965 'moodle_message_send_instantmessages',
11e76602 966 'core_course_get_contents',
6a403810 967 'core_get_component_strings',
925f4d6b 968 'core_user_add_user_device',
cb9d8257
JL
969 'core_calendar_get_calendar_events',
970 'core_enrol_get_users_courses',
971 'core_enrol_get_enrolled_users',
972 'core_user_get_users_by_id',
973 'core_webservice_get_site_info',
974 'core_notes_create_notes',
975 'core_user_get_course_user_profiles',
ba1dc597
JL
976 'core_message_send_instant_messages',
977 'mod_assign_get_grades',
978 'mod_assign_get_assignments',
979 'mod_assign_get_submissions',
980 'mod_assign_get_user_flags',
981 'mod_assign_set_user_flags',
982 'mod_assign_get_user_mappings',
983 'mod_assign_revert_submissions_to_draft',
984 'mod_assign_lock_submissions',
985 'mod_assign_unlock_submissions',
986 'mod_assign_save_submission',
987 'mod_assign_submit_for_grading',
988 'mod_assign_save_grade',
989 'mod_assign_save_user_extensions',
6acfacfa
JL
990 'mod_assign_reveal_identities',
991 'message_airnotifier_is_system_configured',
2e04d250 992 'message_airnotifier_are_notification_preferences_configured',
e2ede426
JL
993 'core_grades_update_grades',
994 'mod_forum_get_forums_by_courses',
2ce8934b 995 'mod_forum_get_forum_discussions_paginated',
feae0f9f 996 'mod_forum_get_forum_discussion_posts',
aff9da17 997 'core_files_get_files',
93872873
JL
998 'core_message_get_messages',
999 'core_message_create_contacts',
1000 'core_message_delete_contacts',
1001 'core_message_block_contacts',
1002 'core_message_unblock_contacts',
1003 'core_message_get_contacts',
60ab2e1b 1004 'core_message_search_contacts',
3a2ba746 1005 'core_message_get_blocked_users',
5d62e813 1006 'gradereport_user_get_grades_table',
db23cd08
AN
1007 'core_group_get_course_user_groups',
1008 'core_user_remove_user_device',
31c202b0 1009 'core_course_get_courses'
60ab2e1b 1010 ),
96e0194c
SH
1011 'enabled' => 0,
1012 'restrictedusers' => 0,
af03513f 1013 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
106c55fb
DW
1014 'downloadfiles' => 1,
1015 'uploadfiles' => 1
96e0194c
SH
1016 ),
1017);