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