MDL-30981 Upgrade API: Added related phpdocs
[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
38 // === group related functions ===
f5072177 39
9a0df45a 40 'moodle_group_create_groups' => array(
5d1017e1
JM
41 'classname' => 'core_group_external',
42 'methodname' => 'create_groups',
43 'classpath' => 'group/externallib.php',
44 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_create_groups(). ',
45 'type' => 'write',
46 'capabilities'=> 'moodle/course:managegroups',
47 ),
48
49 'core_group_create_groups' => array(
50 'classname' => 'core_group_external',
9a0df45a 51 'methodname' => 'create_groups',
52 'classpath' => 'group/externallib.php',
f5072177 53 'description' => 'Creates new groups.',
54 'type' => 'write',
72f68b51 55 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 56 ),
f5072177 57
9a0df45a 58 'moodle_group_get_groups' => array(
5d1017e1
JM
59 'classname' => 'core_group_external',
60 'methodname' => 'get_groups',
61 'classpath' => 'group/externallib.php',
62 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_groups()',
63 'type' => 'read',
64 'capabilities'=> 'moodle/course:managegroups',
65 ),
66
67 'core_group_get_groups' => array(
68 'classname' => 'core_group_external',
9a0df45a 69 'methodname' => 'get_groups',
70 'classpath' => 'group/externallib.php',
cfb99b75 71 'description' => 'Returns group details.',
f5072177 72 'type' => 'read',
72f68b51 73 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 74 ),
246f6da2 75
76 'moodle_group_get_course_groups' => array(
5d1017e1
JM
77 'classname' => 'core_group_external',
78 'methodname' => 'get_course_groups',
79 'classpath' => 'group/externallib.php',
80 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_course_groups()',
81 'type' => 'read',
82 'capabilities'=> 'moodle/course:managegroups',
83 ),
84
85 'core_group_get_course_groups' => array(
86 'classname' => 'core_group_external',
246f6da2 87 'methodname' => 'get_course_groups',
88 'classpath' => 'group/externallib.php',
89 'description' => 'Returns all groups in specified course.',
90 'type' => 'read',
72f68b51 91 'capabilities'=> 'moodle/course:managegroups',
246f6da2 92 ),
2cb1ee78 93
9a0df45a 94 'moodle_group_delete_groups' => array(
5d1017e1
JM
95 'classname' => 'core_group_external',
96 'methodname' => 'delete_groups',
97 'classpath' => 'group/externallib.php',
98 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_groups()',
99 'type' => 'delete',
100 'capabilities'=> 'moodle/course:managegroups',
101 ),
102
103 'core_group_delete_groups' => array(
104 'classname' => 'core_group_external',
9a0df45a 105 'methodname' => 'delete_groups',
106 'classpath' => 'group/externallib.php',
0f4e72de
PS
107 'description' => 'Deletes all specified groups.',
108 'type' => 'delete',
72f68b51 109 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 110 ),
c863dc38 111
9a0df45a 112 'moodle_group_get_groupmembers' => array(
5d1017e1
JM
113 'classname' => 'core_group_external',
114 'methodname' => 'get_group_members',
115 'classpath' => 'group/externallib.php',
116 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_group_members()',
117 'type' => 'read',
118 'capabilities'=> 'moodle/course:managegroups',
119 ),
120
121 'core_group_get_group_members' => array(
122 'classname' => 'core_group_external',
123 'methodname' => 'get_group_members',
9a0df45a 124 'classpath' => 'group/externallib.php',
0f4e72de
PS
125 'description' => 'Returns group members.',
126 'type' => 'read',
72f68b51 127 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 128 ),
4efa2483 129
9a0df45a 130 'moodle_group_add_groupmembers' => array(
5d1017e1
JM
131 'classname' => 'core_group_external',
132 'methodname' => 'add_group_members',
133 'classpath' => 'group/externallib.php',
134 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_add_group_members()',
135 'type' => 'write',
136 'capabilities'=> 'moodle/course:managegroups',
137 ),
138
139 'core_group_add_group_members' => array(
140 'classname' => 'core_group_external',
141 'methodname' => 'add_group_members',
9a0df45a 142 'classpath' => 'group/externallib.php',
0f4e72de
PS
143 'description' => 'Adds group members.',
144 'type' => 'write',
72f68b51 145 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 146 ),
147
148 'moodle_group_delete_groupmembers' => array(
5d1017e1
JM
149 'classname' => 'core_group_external',
150 'methodname' => 'delete_group_members',
9a0df45a 151 'classpath' => 'group/externallib.php',
5d1017e1 152 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_group_members()',
0f4e72de 153 'type' => 'delete',
72f68b51 154 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 155 ),
72f68b51 156
5d1017e1
JM
157 'core_group_delete_group_members' => array(
158 'classname' => 'core_group_external',
159 'methodname' => 'delete_group_members',
160 'classpath' => 'group/externallib.php',
161 'description' => 'Deletes group members.',
162 'type' => 'delete',
163 'capabilities'=> 'moodle/course:managegroups',
164 ),
72f68b51 165
166 // === file related functions ===
167
249c4f60 168 'moodle_file_get_files' => array(
5d1017e1
JM
169 'classname' => 'core_files_external',
170 'methodname' => 'get_files',
171 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_get_files()',
172 'type' => 'read',
173 'classpath' => 'files/externallib.php',
174 ),
175
176 'core_files_get_files' => array(
177 'classname' => 'core_files_external',
249c4f60
DC
178 'methodname' => 'get_files',
179 'description' => 'browse moodle files',
180 'type' => 'read',
181 'classpath' => 'files/externallib.php',
182 ),
5d1017e1 183
249c4f60 184 'moodle_file_upload' => array(
5d1017e1
JM
185 'classname' => 'core_files_external',
186 'methodname' => 'upload',
187 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_upload()',
188 'type' => 'write',
189 'classpath' => 'files/externallib.php',
190 ),
191
192 'core_files_upload' => array(
193 'classname' => 'core_files_external',
249c4f60
DC
194 'methodname' => 'upload',
195 'description' => 'upload a file to moodle',
196 'type' => 'write',
197 'classpath' => 'files/externallib.php',
198 ),
4efa2483 199
ef22c1b6 200 // === user related functions ===
72f68b51 201
ef22c1b6 202 'moodle_user_create_users' => array(
5d1017e1
JM
203 'classname' => 'core_user_external',
204 'methodname' => 'create_users',
205 'classpath' => 'user/externallib.php',
206 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_create_users()',
207 'type' => 'write',
208 'capabilities'=> 'moodle/user:create',
209 ),
210
211 'core_user_create_users' => array(
212 'classname' => 'core_user_external',
ef22c1b6 213 'methodname' => 'create_users',
214 'classpath' => 'user/externallib.php',
fb79269b 215 'description' => 'Create users.',
216 'type' => 'write',
72f68b51 217 'capabilities'=> 'moodle/user:create',
ef22c1b6 218 ),
219
fb79269b 220 'moodle_user_get_users_by_id' => array(
5d1017e1
JM
221 'classname' => 'core_user_external',
222 'methodname' => 'get_users_by_id',
223 'classpath' => 'user/externallib.php',
224 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_users_by_id()',
225 'type' => 'read',
226 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
227 ),
228
229 'core_user_get_users_by_id' => array(
230 'classname' => 'core_user_external',
fb79269b 231 'methodname' => 'get_users_by_id',
ef22c1b6 232 'classpath' => 'user/externallib.php',
fb79269b 233 'description' => 'Get users by id.',
234 'type' => 'read',
b4c74367 235 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
ef22c1b6 236 ),
237
01479290 238 'moodle_user_get_users_by_courseid' => array(
5d1017e1
JM
239 'classname' => 'core_enrol_external',
240 'methodname' => 'get_enrolled_users',
241 'classpath' => 'enrol/externallib.php',
242 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_enrolled_users()',
01479290
DC
243 'type' => 'read',
244 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
245 ),
246
ea4e96c2 247 'moodle_user_get_course_participants_by_id' => array(
5d1017e1
JM
248 'classname' => 'core_user_external',
249 'methodname' => 'get_course_user_profiles',
ea4e96c2 250 'classpath' => 'user/externallib.php',
5d1017e1
JM
251 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_course_user_profiles()',
252 'type' => 'read',
253 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
254 ),
255
256 'core_user_get_course_user_profiles' => array(
257 'classname' => 'core_user_external',
258 'methodname' => 'get_course_user_profiles',
259 'classpath' => 'user/externallib.php',
260 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
ea4e96c2
DC
261 'type' => 'read',
262 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
263 ),
264
ef22c1b6 265 'moodle_user_delete_users' => array(
5d1017e1
JM
266 'classname' => 'core_user_external',
267 'methodname' => 'delete_users',
268 'classpath' => 'user/externallib.php',
269 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_delete_users()',
270 'type' => 'write',
271 'capabilities'=> 'moodle/user:delete',
272 ),
273
274 'core_user_delete_users' => array(
275 'classname' => 'core_user_external',
ef22c1b6 276 'methodname' => 'delete_users',
277 'classpath' => 'user/externallib.php',
fb79269b 278 'description' => 'Delete users.',
279 'type' => 'write',
72f68b51 280 'capabilities'=> 'moodle/user:delete',
ef22c1b6 281 ),
282
283 'moodle_user_update_users' => array(
5d1017e1
JM
284 'classname' => 'core_user_external',
285 'methodname' => 'update_users',
286 'classpath' => 'user/externallib.php',
287 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_update_users()',
288 'type' => 'write',
289 'capabilities'=> 'moodle/user:update',
290 ),
291
292 'core_user_update_users' => array(
293 'classname' => 'core_user_external',
ef22c1b6 294 'methodname' => 'update_users',
295 'classpath' => 'user/externallib.php',
fb79269b 296 'description' => 'Update users.',
297 'type' => 'write',
72f68b51 298 'capabilities'=> 'moodle/user:update',
ef22c1b6 299 ),
e9b66095 300
72f68b51 301 // === enrol related functions ===
302
df997f84
PS
303 'moodle_enrol_get_enrolled_users' => array(
304 'classname' => 'moodle_enrol_external',
305 'methodname' => 'get_enrolled_users',
306 'classpath' => 'enrol/externallib.php',
5d1017e1 307 '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 308 'type' => 'read',
72f68b51 309 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
310 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84 311 ),
e6acc551 312
5d1017e1
JM
313 'core_enrol_get_enrolled_users' => array(
314 'classname' => 'core_enrol_external',
315 'methodname' => 'get_enrolled_users',
316 'classpath' => 'enrol/externallib.php',
317 'description' => 'Get enrolled users by course id.',
318 'type' => 'read',
319 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
320 ),
df997f84 321
3364dbb5 322 'moodle_enrol_get_users_courses' => array(
5d1017e1 323 'classname' => 'core_enrol_external',
3364dbb5
PS
324 'methodname' => 'get_users_courses',
325 'classpath' => 'enrol/externallib.php',
5d1017e1 326 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_users_courses()',
3364dbb5
PS
327 'type' => 'read',
328 'capabilities'=> 'moodle/course:viewparticipants',
329 ),
330
5d1017e1
JM
331 'core_enrol_get_users_courses' => array(
332 'classname' => 'core_enrol_external',
333 'methodname' => 'get_users_courses',
334 'classpath' => 'enrol/externallib.php',
335 'description' => 'Get the list of courses where a user is enrolled in',
336 'type' => 'read',
337 'capabilities'=> 'moodle/course:viewparticipants',
338 ),
339
340 // === Role related functions ===
341
df997f84 342 'moodle_role_assign' => array(
5d1017e1
JM
343 'classname' => 'core_role_external',
344 'methodname' => 'assign_roles',
345 'classpath' => 'enrol/externallib.php',
346 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_assign_role()',
347 'type' => 'write',
348 'capabilities'=> 'moodle/role:assign',
349 ),
350
351 'core_role_assign_roles' => array(
352 'classname' => 'core_role_external',
353 'methodname' => 'assign_roles',
e9b66095 354 'classpath' => 'enrol/externallib.php',
df997f84 355 'description' => 'Manual role assignments.',
e9b66095 356 'type' => 'write',
72f68b51 357 'capabilities'=> 'moodle/role:assign',
e9b66095 358 ),
359
df997f84 360 'moodle_role_unassign' => array(
5d1017e1
JM
361 'classname' => 'core_role_external',
362 'methodname' => 'unassign_roles',
363 'classpath' => 'enrol/externallib.php',
364 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_unassign_role()',
365 'type' => 'write',
366 'capabilities'=> 'moodle/role:assign',
367 ),
368
369 'core_role_unassign_roles' => array(
370 'classname' => 'core_role_external',
371 'methodname' => 'unassign_roles',
e9b66095 372 'classpath' => 'enrol/externallib.php',
df997f84 373 'description' => 'Manual role unassignments.',
e9b66095 374 'type' => 'write',
72f68b51 375 'capabilities'=> 'moodle/role:assign',
e9b66095 376 ),
5b4a78e2 377
6bb31e40 378 // === course related functions ===
379
380 'moodle_course_get_courses' => array(
5d1017e1
JM
381 'classname' => 'core_course_external',
382 'methodname' => 'get_courses',
383 'classpath' => 'course/externallib.php',
384 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_get_courses()',
385 'type' => 'read',
386 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
387 ),
388
389 'core_course_get_courses' => array(
390 'classname' => 'core_course_external',
6bb31e40 391 'methodname' => 'get_courses',
392 'classpath' => 'course/externallib.php',
393 'description' => 'Return course details',
394 'type' => 'read',
395 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
396 ),
397
398 'moodle_course_create_courses' => array(
5d1017e1
JM
399 'classname' => 'core_course_external',
400 'methodname' => 'create_courses',
401 'classpath' => 'course/externallib.php',
402 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_create_courses()',
403 'type' => 'write',
404 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
405 ),
406
407 'core_course_create_courses' => array(
408 'classname' => 'core_course_external',
6bb31e40 409 'methodname' => 'create_courses',
410 'classpath' => 'course/externallib.php',
411 'description' => 'Create new courses',
412 'type' => 'write',
413 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
414 ),
415
ec0d6ea2
DC
416 'core_course_get_contents' => array(
417 'classname' => 'core_course_external',
418 'methodname' => 'get_course_contents',
419 'classpath' => 'course/externallib.php',
420 'description' => 'Get course contents',
421 'type' => 'read',
422 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
423 ),
424
a623b6b8
JM
425 // === message related functions ===
426
4de00da7 427 'moodle_message_send_instantmessages' => array(
5d1017e1
JM
428 'classname' => 'core_message_external',
429 'methodname' => 'send_instant_messages',
430 'classpath' => 'message/externallib.php',
431 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_message_send_instant_messages()',
432 'type' => 'write',
433 'capabilities'=> 'moodle/site:sendmessage',
434 ),
435
436 'core_message_send_instant_messages' => array(
437 'classname' => 'core_message_external',
438 'methodname' => 'send_instant_messages',
a623b6b8 439 'classpath' => 'message/externallib.php',
4de00da7 440 'description' => 'Send instant messages',
a623b6b8
JM
441 'type' => 'write',
442 'capabilities'=> 'moodle/site:sendmessage',
443 ),
444
8d46dabb
JM
445 // === notes related functions ===
446
447 'moodle_notes_create_notes' => array(
5d1017e1
JM
448 'classname' => 'core_notes_external',
449 'methodname' => 'create_notes',
450 'classpath' => 'notes/externallib.php',
451 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_notes_create_notes()',
452 'type' => 'write',
453 'capabilities'=> 'moodle/notes:manage',
454 ),
455
456 'core_notes_create_notes' => array(
457 'classname' => 'core_notes_external',
8d46dabb
JM
458 'methodname' => 'create_notes',
459 'classpath' => 'notes/externallib.php',
460 'description' => 'Create notes',
461 'type' => 'write',
462 'capabilities'=> 'moodle/notes:manage',
463 ),
464
0bf486a6
JM
465 // === webservice related functions ===
466
467 'moodle_webservice_get_siteinfo' => array(
5d1017e1
JM
468 'classname' => 'core_webservice_external',
469 'methodname' => 'get_site_info',
470 'classpath' => 'webservice/externallib.php',
471 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_webservice_get_site_info()',
472 'type' => 'read',
473 ),
474
475 'core_webservice_get_site_info' => array(
476 'classname' => 'core_webservice_external',
477 'methodname' => 'get_site_info',
0bf486a6
JM
478 'classpath' => 'webservice/externallib.php',
479 'description' => 'Return some site info / user info / list web service functions',
480 'type' => 'read',
481 ),
482
9a0df45a 483);
c1b65883
JM
484
485$services = array(
96e0194c
SH
486 'Moodle mobile web service' => array(
487 'functions' => array (
488 'moodle_enrol_get_users_courses',
489 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
490 'moodle_user_get_users_by_id',
491 'moodle_webservice_get_siteinfo',
492 'moodle_notes_create_notes',
ea4e96c2 493 'moodle_user_get_course_participants_by_id',
01479290 494 'moodle_user_get_users_by_courseid',
ec0d6ea2
DC
495 'moodle_message_send_instantmessages',
496 'core_course_get_contents'),
96e0194c
SH
497 'enabled' => 0,
498 'restrictedusers' => 0,
af03513f
JM
499 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
500 'downloadfiles' => 1
96e0194c
SH
501 ),
502);