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