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