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