MDL-49499 user: Add core_user_view_user_profile to the mobile service
[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
5770f10e
JL
516 'core_user_view_user_profile' => array(
517 'classname' => 'core_user_external',
518 'methodname' => 'view_user_profile',
519 'classpath' => 'user/externallib.php',
520 'description' => 'Simulates the web-interface view of user/view.php and user/profile.php (triggering events).',
521 'type' => 'write',
522 'capabilities' => 'moodle/user:viewdetails',
523 ),
524
72f68b51 525 // === enrol related functions ===
d0068cd0 526
b6b6c7ac
PC
527 'core_enrol_get_enrolled_users_with_capability' => array(
528 'classname' => 'core_enrol_external',
529 'methodname' => 'get_enrolled_users_with_capability',
530 'classpath' => 'enrol/externallib.php',
531 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
532 and have that capability',
533 'type' => 'read',
534 ),
72f68b51 535
df997f84
PS
536 'moodle_enrol_get_enrolled_users' => array(
537 'classname' => 'moodle_enrol_external',
538 'methodname' => 'get_enrolled_users',
539 'classpath' => 'enrol/externallib.php',
5d1017e1 540 '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 541 'type' => 'read',
72f68b51 542 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
543 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84 544 ),
e6acc551 545
5d1017e1
JM
546 'core_enrol_get_enrolled_users' => array(
547 'classname' => 'core_enrol_external',
548 'methodname' => 'get_enrolled_users',
549 'classpath' => 'enrol/externallib.php',
550 'description' => 'Get enrolled users by course id.',
551 'type' => 'read',
552 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
553 ),
df997f84 554
3364dbb5 555 'moodle_enrol_get_users_courses' => array(
3c1aa6fd 556 'classname' => 'moodle_enrol_external',
3364dbb5
PS
557 'methodname' => 'get_users_courses',
558 'classpath' => 'enrol/externallib.php',
3c1aa6fd 559 '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
560 'type' => 'read',
561 'capabilities'=> 'moodle/course:viewparticipants',
562 ),
563
5d1017e1
JM
564 'core_enrol_get_users_courses' => array(
565 'classname' => 'core_enrol_external',
566 'methodname' => 'get_users_courses',
567 'classpath' => 'enrol/externallib.php',
568 'description' => 'Get the list of courses where a user is enrolled in',
569 'type' => 'read',
570 'capabilities'=> 'moodle/course:viewparticipants',
571 ),
572
be9bf94e
RT
573 'core_enrol_get_course_enrolment_methods' => array(
574 'classname' => 'core_enrol_external',
575 'methodname' => 'get_course_enrolment_methods',
576 'classpath' => 'enrol/externallib.php',
577 'description' => 'Get the list of course enrolment methods',
578 'type' => 'read',
579 ),
580
5d1017e1
JM
581 // === Role related functions ===
582
df997f84 583 'moodle_role_assign' => array(
3c1aa6fd
DM
584 'classname' => 'moodle_enrol_external',
585 'methodname' => 'role_assign',
5d1017e1 586 'classpath' => 'enrol/externallib.php',
3c1aa6fd 587 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()',
5d1017e1
JM
588 'type' => 'write',
589 'capabilities'=> 'moodle/role:assign',
590 ),
591
592 'core_role_assign_roles' => array(
593 'classname' => 'core_role_external',
594 'methodname' => 'assign_roles',
e9b66095 595 'classpath' => 'enrol/externallib.php',
df997f84 596 'description' => 'Manual role assignments.',
e9b66095 597 'type' => 'write',
72f68b51 598 'capabilities'=> 'moodle/role:assign',
e9b66095 599 ),
600
df997f84 601 'moodle_role_unassign' => array(
3c1aa6fd
DM
602 'classname' => 'moodle_enrol_external',
603 'methodname' => 'role_unassign',
5d1017e1 604 'classpath' => 'enrol/externallib.php',
3c1aa6fd 605 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()',
5d1017e1
JM
606 'type' => 'write',
607 'capabilities'=> 'moodle/role:assign',
608 ),
609
610 'core_role_unassign_roles' => array(
611 'classname' => 'core_role_external',
612 'methodname' => 'unassign_roles',
e9b66095 613 'classpath' => 'enrol/externallib.php',
df997f84 614 'description' => 'Manual role unassignments.',
e9b66095 615 'type' => 'write',
72f68b51 616 'capabilities'=> 'moodle/role:assign',
e9b66095 617 ),
5b4a78e2 618
6bb31e40 619 // === course related functions ===
620
3ec163dd 621 'core_course_get_contents' => array(
d4a246bc 622 'classname' => 'core_course_external',
3ec163dd 623 'methodname' => 'get_course_contents',
d4a246bc 624 'classpath' => 'course/externallib.php',
3ec163dd 625 'description' => 'Get course contents',
d4a246bc 626 'type' => 'read',
3ec163dd 627 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
f2229c68 628 ),
d6ebe011 629
6bb31e40 630 'moodle_course_get_courses' => array(
3c1aa6fd 631 'classname' => 'moodle_course_external',
5d1017e1
JM
632 'methodname' => 'get_courses',
633 'classpath' => 'course/externallib.php',
3c1aa6fd 634 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()',
5d1017e1
JM
635 'type' => 'read',
636 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
637 ),
638
639 'core_course_get_courses' => array(
640 'classname' => 'core_course_external',
6bb31e40 641 'methodname' => 'get_courses',
642 'classpath' => 'course/externallib.php',
643 'description' => 'Return course details',
644 'type' => 'read',
645 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
646 ),
647
648 'moodle_course_create_courses' => array(
3c1aa6fd 649 'classname' => 'moodle_course_external',
5d1017e1
JM
650 'methodname' => 'create_courses',
651 'classpath' => 'course/externallib.php',
3c1aa6fd 652 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()',
5d1017e1
JM
653 'type' => 'write',
654 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
655 ),
656
657 'core_course_create_courses' => array(
658 'classname' => 'core_course_external',
6bb31e40 659 'methodname' => 'create_courses',
660 'classpath' => 'course/externallib.php',
661 'description' => 'Create new courses',
662 'type' => 'write',
663 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
664 ),
665
63a85dc7
JL
666 'core_course_delete_courses' => array(
667 'classname' => 'core_course_external',
668 'methodname' => 'delete_courses',
669 'classpath' => 'course/externallib.php',
670 'description' => 'Deletes all specified courses',
671 'type' => 'write',
672 'capabilities'=> 'moodle/course:delete',
673 ),
674
79949c1b
MN
675 'core_course_delete_modules' => array(
676 'classname' => 'core_course_external',
677 'methodname' => 'delete_modules',
678 'classpath' => 'course/externallib.php',
679 'description' => 'Deletes all specified module instances',
680 'type' => 'write',
681 'capabilities' => 'moodle/course:manageactivities'
682 ),
683
3dc1d76e
JL
684 'core_course_duplicate_course' => array(
685 'classname' => 'core_course_external',
686 'methodname' => 'duplicate_course',
687 'classpath' => 'course/externallib.php',
688 'description' => 'Duplicate an existing course (creating a new one) without user data',
689 'type' => 'write',
690 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
691 ),
692
791723c3
RT
693 'core_course_update_courses' => array(
694 'classname' => 'core_course_external',
695 'methodname' => 'update_courses',
696 'classpath' => 'course/externallib.php',
697 'description' => 'Update courses',
698 'type' => 'write',
699 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
700 ),
701
c4f7bf29
JL
702 'core_course_view_course' => array(
703 'classname' => 'core_course_external',
704 'methodname' => 'view_course',
705 'classpath' => 'course/externallib.php',
706 'description' => 'Log that the course was viewed',
707 'type' => 'write'
708 ),
709
710
3ec163dd
EL
711 // === course category related functions ===
712
713 'core_course_get_categories' => array(
714 'classname' => 'core_course_external',
715 'methodname' => 'get_categories',
716 'classpath' => 'course/externallib.php',
717 'description' => 'Return category details',
718 'type' => 'read',
719 'capabilities'=> 'moodle/category:viewhiddencategories',
720 ),
721
479a5db1
FS
722 'core_course_create_categories' => array(
723 'classname' => 'core_course_external',
724 'methodname' => 'create_categories',
725 'classpath' => 'course/externallib.php',
726 'description' => 'Create course categories',
727 'type' => 'write',
728 'capabilities'=> 'moodle/category:manage',
729 ),
d6ebe011 730
3ec163dd
EL
731 'core_course_update_categories' => array(
732 'classname' => 'core_course_external',
733 'methodname' => 'update_categories',
734 'classpath' => 'course/externallib.php',
735 'description' => 'Update categories',
736 'type' => 'write',
afe27edc 737 'capabilities'=> 'moodle/category:manage',
3ec163dd
EL
738 ),
739
2f951d86
FS
740 'core_course_delete_categories' => array(
741 'classname' => 'core_course_external',
742 'methodname' => 'delete_categories',
743 'classpath' => 'course/externallib.php',
744 'description' => 'Delete course categories',
745 'type' => 'write',
746 'capabilities'=> 'moodle/category:manage',
747 ),
479a5db1 748
8430d87b
JL
749 'core_course_import_course' => array(
750 'classname' => 'core_course_external',
751 'methodname' => 'import_course',
752 'classpath' => 'course/externallib.php',
753 'description' => 'Import course data from a course into another course. Does not include any user data.',
754 'type' => 'write',
755 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
756 ),
757
a623b6b8
JM
758 // === message related functions ===
759
4de00da7 760 'moodle_message_send_instantmessages' => array(
3c1aa6fd
DM
761 'classname' => 'moodle_message_external',
762 'methodname' => 'send_instantmessages',
5d1017e1 763 'classpath' => 'message/externallib.php',
3c1aa6fd 764 '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
765 'type' => 'write',
766 'capabilities'=> 'moodle/site:sendmessage',
767 ),
768
769 'core_message_send_instant_messages' => array(
770 'classname' => 'core_message_external',
771 'methodname' => 'send_instant_messages',
a623b6b8 772 'classpath' => 'message/externallib.php',
4de00da7 773 'description' => 'Send instant messages',
a623b6b8
JM
774 'type' => 'write',
775 'capabilities'=> 'moodle/site:sendmessage',
776 ),
777
d6731600
FM
778 'core_message_create_contacts' => array(
779 'classname' => 'core_message_external',
780 'methodname' => 'create_contacts',
781 'classpath' => 'message/externallib.php',
782 'description' => 'Add contacts to the contact list',
783 'type' => 'write',
784 'capabilities'=> '',
785 ),
786
787 'core_message_delete_contacts' => array(
788 'classname' => 'core_message_external',
789 'methodname' => 'delete_contacts',
790 'classpath' => 'message/externallib.php',
791 'description' => 'Remove contacts from the contact list',
792 'type' => 'write',
793 'capabilities'=> '',
794 ),
795
796 'core_message_block_contacts' => array(
797 'classname' => 'core_message_external',
798 'methodname' => 'block_contacts',
799 'classpath' => 'message/externallib.php',
800 'description' => 'Block contacts',
801 'type' => 'write',
802 'capabilities'=> '',
803 ),
804
805 'core_message_unblock_contacts' => array(
806 'classname' => 'core_message_external',
807 'methodname' => 'unblock_contacts',
808 'classpath' => 'message/externallib.php',
809 'description' => 'Unblock contacts',
810 'type' => 'write',
811 'capabilities'=> '',
812 ),
813
814 'core_message_get_contacts' => array(
815 'classname' => 'core_message_external',
816 'methodname' => 'get_contacts',
817 'classpath' => 'message/externallib.php',
818 'description' => 'Retrieve the contact list',
819 'type' => 'read',
820 'capabilities'=> '',
821 ),
822
823 'core_message_search_contacts' => array(
824 'classname' => 'core_message_external',
825 'methodname' => 'search_contacts',
826 'classpath' => 'message/externallib.php',
827 'description' => 'Search for contacts',
828 'type' => 'read',
829 'capabilities'=> '',
830 ),
831
aff9da17 832 'core_message_get_messages' => array(
6ff4464b
JL
833 'classname' => 'core_message_external',
834 'methodname' => 'get_messages',
835 'classpath' => 'message/externallib.php',
127ef540 836 'description' => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)',
6ff4464b
JL
837 'type' => 'read',
838 'capabilities' => '',
aff9da17
JL
839 ),
840
60ab2e1b
JL
841 'core_message_get_blocked_users' => array(
842 'classname' => 'core_message_external',
843 'methodname' => 'get_blocked_users',
844 'classpath' => 'message/externallib.php',
845 'description' => 'Retrieve a list of users blocked',
846 'type' => 'read',
847 'capabilities' => '',
848 ),
849
8d46dabb
JM
850 // === notes related functions ===
851
852 'moodle_notes_create_notes' => array(
3c1aa6fd 853 'classname' => 'moodle_notes_external',
5d1017e1
JM
854 'methodname' => 'create_notes',
855 'classpath' => 'notes/externallib.php',
3c1aa6fd 856 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()',
5d1017e1
JM
857 'type' => 'write',
858 'capabilities'=> 'moodle/notes:manage',
859 ),
860
861 'core_notes_create_notes' => array(
862 'classname' => 'core_notes_external',
8d46dabb
JM
863 'methodname' => 'create_notes',
864 'classpath' => 'notes/externallib.php',
865 'description' => 'Create notes',
866 'type' => 'write',
867 'capabilities'=> 'moodle/notes:manage',
868 ),
869
34348b2b
JF
870 'core_notes_delete_notes' => array(
871 'classname' => 'core_notes_external',
872 'methodname' => 'delete_notes',
873 'classpath' => 'notes/externallib.php',
874 'description' => 'Delete notes',
875 'type' => 'write',
876 'capabilities'=> 'moodle/notes:manage',
877 ),
878
879 'core_notes_get_notes' => array(
880 'classname' => 'core_notes_external',
881 'methodname' => 'get_notes',
882 'classpath' => 'notes/externallib.php',
883 'description' => 'Get notes',
884 'type' => 'read',
885 'capabilities'=> 'moodle/notes:view',
886 ),
887
888 'core_notes_update_notes' => array(
889 'classname' => 'core_notes_external',
890 'methodname' => 'update_notes',
891 'classpath' => 'notes/externallib.php',
892 'description' => 'Update notes',
893 'type' => 'write',
894 'capabilities'=> 'moodle/notes:manage',
895 ),
896
9028d9b5
PC
897 // === grading related functions ===
898
899 'core_grading_get_definitions' => array(
900 'classname' => 'core_grading_external',
901 'methodname' => 'get_definitions',
9028d9b5
PC
902 'description' => 'Get grading definitions',
903 'type' => 'read'
904 ),
3f0ea6d8
PC
905
906 'core_grade_get_definitions' => array(
907 'classname' => 'core_grade_external',
908 'methodname' => 'get_definitions',
909 'classpath' => 'grade/externallib.php',
9028d9b5
PC
910 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()',
911 'type' => 'read'
912 ),
913
0ff4ebb4
PC
914 'core_grading_save_definitions' => array(
915 'classname' => 'core_grading_external',
916 'methodname' => 'save_definitions',
917 'description' => 'Save grading definitions',
918 'type' => 'write'
919 ),
920
9028d9b5
PC
921 'core_grading_get_gradingform_instances' => array(
922 'classname' => 'core_grading_external',
923 'methodname' => 'get_gradingform_instances',
9028d9b5 924 'description' => 'Get grading form instances',
3f0ea6d8
PC
925 'type' => 'read'
926 ),
927
0bf486a6
JM
928 // === webservice related functions ===
929
930 'moodle_webservice_get_siteinfo' => array(
3c1aa6fd
DM
931 'classname' => 'moodle_webservice_external',
932 'methodname' => 'get_siteinfo',
5d1017e1 933 'classpath' => 'webservice/externallib.php',
3c1aa6fd 934 '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
935 'type' => 'read',
936 ),
937
938 'core_webservice_get_site_info' => array(
939 'classname' => 'core_webservice_external',
940 'methodname' => 'get_site_info',
0bf486a6
JM
941 'classpath' => 'webservice/externallib.php',
942 'description' => 'Return some site info / user info / list web service functions',
943 'type' => 'read',
944 ),
945
11e76602
JM
946 'core_get_string' => array(
947 'classname' => 'core_external',
948 'methodname' => 'get_string',
949 'classpath' => 'lib/external/externallib.php',
950 'description' => 'Return a translated string - similar to core get_string() call',
951 'type' => 'read',
952 ),
953
954 'core_get_strings' => array(
955 'classname' => 'core_external',
956 'methodname' => 'get_strings',
957 'classpath' => 'lib/external/externallib.php',
958 'description' => 'Return some translated strings - like several core get_string() calls',
959 'type' => 'read',
960 ),
961
962 'core_get_component_strings' => array(
963 'classname' => 'core_external',
964 'methodname' => 'get_component_strings',
965 'classpath' => 'lib/external/externallib.php',
966 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
967 - similar to core get_component_strings() call',
968 'type' => 'read',
969 ),
5e1350ab
AA
970
971
972 // === Calendar related functions ===
973
974 'core_calendar_delete_calendar_events' => array(
975 'classname' => 'core_calendar_external',
976 'methodname' => 'delete_calendar_events',
977 'description' => 'Delete calendar events',
978 'classpath' => 'calendar/externallib.php',
979 'type' => 'write',
980 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
981 ),
982
793d3855
AA
983
984 'core_calendar_get_calendar_events' => array(
985 'classname' => 'core_calendar_external',
986 'methodname' => 'get_calendar_events',
987 'description' => 'Get calendar events',
988 'classpath' => 'calendar/externallib.php',
989 'type' => 'read',
990 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
991 ),
992
c66dc3df
AA
993 'core_calendar_create_calendar_events' => array(
994 'classname' => 'core_calendar_external',
995 'methodname' => 'create_calendar_events',
996 'description' => 'Create calendar events',
997 'classpath' => 'calendar/externallib.php',
998 'type' => 'write',
999 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
1000 ),
9bdcf579
DW
1001
1002 'core_output_load_template' => array(
1003 'classname' => 'core\output\external',
1004 'methodname' => 'load_template',
1005 'description' => 'Load a template for a renderable',
1006 'type' => 'read'
1007 ),
25c49a85
JL
1008
1009 // Completion related functions.
1010 'core_completion_update_activity_completion_status_manually' => array(
1011 'classname' => 'core_completion_external',
1012 'methodname' => 'update_activity_completion_status_manually',
1013 'description' => 'Update completion status for the current user in an activity, only for activities with manual tracking.',
1014 'type' => 'write',
1015 ),
9a0df45a 1016);
c1b65883
JM
1017
1018$services = array(
96e0194c
SH
1019 'Moodle mobile web service' => array(
1020 'functions' => array (
1021 'moodle_enrol_get_users_courses',
1022 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
1023 'moodle_user_get_users_by_id',
1024 'moodle_webservice_get_siteinfo',
1025 'moodle_notes_create_notes',
ea4e96c2 1026 'moodle_user_get_course_participants_by_id',
01479290 1027 'moodle_user_get_users_by_courseid',
ec0d6ea2 1028 'moodle_message_send_instantmessages',
11e76602 1029 'core_course_get_contents',
6a403810 1030 'core_get_component_strings',
925f4d6b 1031 'core_user_add_user_device',
cb9d8257
JL
1032 'core_calendar_get_calendar_events',
1033 'core_enrol_get_users_courses',
1034 'core_enrol_get_enrolled_users',
1035 'core_user_get_users_by_id',
1036 'core_webservice_get_site_info',
1037 'core_notes_create_notes',
1038 'core_user_get_course_user_profiles',
ba1dc597
JL
1039 'core_message_send_instant_messages',
1040 'mod_assign_get_grades',
1041 'mod_assign_get_assignments',
1042 'mod_assign_get_submissions',
1043 'mod_assign_get_user_flags',
1044 'mod_assign_set_user_flags',
1045 'mod_assign_get_user_mappings',
1046 'mod_assign_revert_submissions_to_draft',
1047 'mod_assign_lock_submissions',
1048 'mod_assign_unlock_submissions',
1049 'mod_assign_save_submission',
1050 'mod_assign_submit_for_grading',
1051 'mod_assign_save_grade',
1052 'mod_assign_save_user_extensions',
6acfacfa
JL
1053 'mod_assign_reveal_identities',
1054 'message_airnotifier_is_system_configured',
2e04d250 1055 'message_airnotifier_are_notification_preferences_configured',
e2ede426
JL
1056 'core_grades_update_grades',
1057 'mod_forum_get_forums_by_courses',
2ce8934b 1058 'mod_forum_get_forum_discussions_paginated',
feae0f9f 1059 'mod_forum_get_forum_discussion_posts',
aff9da17 1060 'core_files_get_files',
93872873
JL
1061 'core_message_get_messages',
1062 'core_message_create_contacts',
1063 'core_message_delete_contacts',
1064 'core_message_block_contacts',
1065 'core_message_unblock_contacts',
1066 'core_message_get_contacts',
60ab2e1b 1067 'core_message_search_contacts',
3a2ba746 1068 'core_message_get_blocked_users',
5d62e813 1069 'gradereport_user_get_grades_table',
db23cd08
AN
1070 'core_group_get_course_user_groups',
1071 'core_user_remove_user_device',
25c49a85
JL
1072 'core_course_get_courses',
1073 'core_completion_update_activity_completion_status_manually',
e77a0f36
JL
1074 'mod_data_get_databases_by_courses',
1075 'core_comment_get_comments',
449a6304 1076 'mod_forum_view_forum',
c4f7bf29 1077 'core_course_view_course',
604afeff 1078 'core_completion_get_activities_completion_status',
9857381d 1079 'core_notes_get_course_notes',
5770f10e 1080 'core_user_view_user_profile',
60ab2e1b 1081 ),
96e0194c
SH
1082 'enabled' => 0,
1083 'restrictedusers' => 0,
af03513f 1084 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
106c55fb
DW
1085 'downloadfiles' => 1,
1086 'uploadfiles' => 1
96e0194c
SH
1087 ),
1088);