weekly release 2.6dev
[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 ),
102
ef22c1b6 103 // === group related functions ===
f5072177 104
9a0df45a 105 'moodle_group_create_groups' => array(
5d1017e1
JM
106 'classname' => 'core_group_external',
107 'methodname' => 'create_groups',
108 'classpath' => 'group/externallib.php',
109 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_create_groups(). ',
110 'type' => 'write',
111 'capabilities'=> 'moodle/course:managegroups',
112 ),
113
114 'core_group_create_groups' => array(
115 'classname' => 'core_group_external',
9a0df45a 116 'methodname' => 'create_groups',
117 'classpath' => 'group/externallib.php',
f5072177 118 'description' => 'Creates new groups.',
119 'type' => 'write',
72f68b51 120 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 121 ),
f5072177 122
9a0df45a 123 'moodle_group_get_groups' => array(
5d1017e1
JM
124 'classname' => 'core_group_external',
125 'methodname' => 'get_groups',
126 'classpath' => 'group/externallib.php',
127 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_groups()',
128 'type' => 'read',
129 'capabilities'=> 'moodle/course:managegroups',
130 ),
131
132 'core_group_get_groups' => array(
133 'classname' => 'core_group_external',
9a0df45a 134 'methodname' => 'get_groups',
135 'classpath' => 'group/externallib.php',
cfb99b75 136 'description' => 'Returns group details.',
f5072177 137 'type' => 'read',
72f68b51 138 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 139 ),
246f6da2 140
141 'moodle_group_get_course_groups' => array(
5d1017e1
JM
142 'classname' => 'core_group_external',
143 'methodname' => 'get_course_groups',
144 'classpath' => 'group/externallib.php',
145 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_course_groups()',
146 'type' => 'read',
147 'capabilities'=> 'moodle/course:managegroups',
148 ),
149
150 'core_group_get_course_groups' => array(
151 'classname' => 'core_group_external',
246f6da2 152 'methodname' => 'get_course_groups',
153 'classpath' => 'group/externallib.php',
154 'description' => 'Returns all groups in specified course.',
155 'type' => 'read',
72f68b51 156 'capabilities'=> 'moodle/course:managegroups',
246f6da2 157 ),
2cb1ee78 158
9a0df45a 159 'moodle_group_delete_groups' => array(
5d1017e1
JM
160 'classname' => 'core_group_external',
161 'methodname' => 'delete_groups',
162 'classpath' => 'group/externallib.php',
163 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_groups()',
164 'type' => 'delete',
165 'capabilities'=> 'moodle/course:managegroups',
166 ),
167
168 'core_group_delete_groups' => array(
169 'classname' => 'core_group_external',
9a0df45a 170 'methodname' => 'delete_groups',
171 'classpath' => 'group/externallib.php',
0f4e72de
PS
172 'description' => 'Deletes all specified groups.',
173 'type' => 'delete',
72f68b51 174 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 175 ),
c863dc38 176
9a0df45a 177 'moodle_group_get_groupmembers' => array(
5d1017e1
JM
178 'classname' => 'core_group_external',
179 'methodname' => 'get_group_members',
180 'classpath' => 'group/externallib.php',
181 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_group_members()',
182 'type' => 'read',
183 'capabilities'=> 'moodle/course:managegroups',
184 ),
185
186 'core_group_get_group_members' => array(
187 'classname' => 'core_group_external',
188 'methodname' => 'get_group_members',
9a0df45a 189 'classpath' => 'group/externallib.php',
0f4e72de
PS
190 'description' => 'Returns group members.',
191 'type' => 'read',
72f68b51 192 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 193 ),
4efa2483 194
9a0df45a 195 'moodle_group_add_groupmembers' => array(
5d1017e1
JM
196 'classname' => 'core_group_external',
197 'methodname' => 'add_group_members',
198 'classpath' => 'group/externallib.php',
199 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_add_group_members()',
200 'type' => 'write',
201 'capabilities'=> 'moodle/course:managegroups',
202 ),
203
204 'core_group_add_group_members' => array(
205 'classname' => 'core_group_external',
206 'methodname' => 'add_group_members',
9a0df45a 207 'classpath' => 'group/externallib.php',
0f4e72de
PS
208 'description' => 'Adds group members.',
209 'type' => 'write',
72f68b51 210 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 211 ),
212
213 'moodle_group_delete_groupmembers' => array(
5d1017e1
JM
214 'classname' => 'core_group_external',
215 'methodname' => 'delete_group_members',
9a0df45a 216 'classpath' => 'group/externallib.php',
5d1017e1 217 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_group_members()',
0f4e72de 218 'type' => 'delete',
72f68b51 219 'capabilities'=> 'moodle/course:managegroups',
9a0df45a 220 ),
72f68b51 221
5d1017e1
JM
222 'core_group_delete_group_members' => array(
223 'classname' => 'core_group_external',
224 'methodname' => 'delete_group_members',
225 'classpath' => 'group/externallib.php',
226 'description' => 'Deletes group members.',
227 'type' => 'delete',
228 'capabilities'=> 'moodle/course:managegroups',
229 ),
72f68b51 230
7ce23590
JL
231 'core_group_create_groupings' => array(
232 'classname' => 'core_group_external',
233 'methodname' => 'create_groupings',
234 'classpath' => 'group/externallib.php',
235 'description' => 'Creates new groupings',
236 'type' => 'write',
237 ),
238
239 'core_group_update_groupings' => array(
240 'classname' => 'core_group_external',
241 'methodname' => 'update_groupings',
242 'classpath' => 'group/externallib.php',
243 'description' => 'Updates existing groupings',
244 'type' => 'write',
245 ),
246
247 'core_group_get_groupings' => array(
248 'classname' => 'core_group_external',
249 'methodname' => 'get_groupings',
250 'classpath' => 'group/externallib.php',
251 'description' => 'Returns groupings details.',
252 'type' => 'read',
253 ),
254
255 'core_group_get_course_groupings' => array(
67aa60f9
JL
256 'classname' => 'core_group_external',
257 'methodname' => 'get_course_groupings',
258 'classpath' => 'group/externallib.php',
259 'description' => 'Returns all groupings in specified course.',
260 'type' => 'read',
7ce23590
JL
261 ),
262
263 'core_group_delete_groupings' => array(
67aa60f9
JL
264 'classname' => 'core_group_external',
265 'methodname' => 'delete_groupings',
266 'classpath' => 'group/externallib.php',
267 'description' => 'Deletes all specified groupings.',
268 'type' => 'write',
7ce23590
JL
269 ),
270
271 'core_group_assign_grouping' => array(
67aa60f9
JL
272 'classname' => 'core_group_external',
273 'methodname' => 'assign_grouping',
274 'classpath' => 'group/externallib.php',
275 'description' => 'Assing groups from groupings',
276 'type' => 'write',
7ce23590
JL
277 ),
278
279 'core_group_unassign_grouping' => array(
67aa60f9
JL
280 'classname' => 'core_group_external',
281 'methodname' => 'unassign_grouping',
282 'classpath' => 'group/externallib.php',
283 'description' => 'Unassing groups from groupings',
284 'type' => 'write',
7ce23590
JL
285 ),
286
72f68b51 287 // === file related functions ===
288
249c4f60 289 'moodle_file_get_files' => array(
5d1017e1
JM
290 'classname' => 'core_files_external',
291 'methodname' => 'get_files',
292 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_get_files()',
293 'type' => 'read',
294 'classpath' => 'files/externallib.php',
295 ),
296
297 'core_files_get_files' => array(
298 'classname' => 'core_files_external',
249c4f60
DC
299 'methodname' => 'get_files',
300 'description' => 'browse moodle files',
301 'type' => 'read',
302 'classpath' => 'files/externallib.php',
303 ),
5d1017e1 304
249c4f60 305 'moodle_file_upload' => array(
5d1017e1
JM
306 'classname' => 'core_files_external',
307 'methodname' => 'upload',
308 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_upload()',
309 'type' => 'write',
310 'classpath' => 'files/externallib.php',
311 ),
312
313 'core_files_upload' => array(
314 'classname' => 'core_files_external',
249c4f60
DC
315 'methodname' => 'upload',
316 'description' => 'upload a file to moodle',
317 'type' => 'write',
318 'classpath' => 'files/externallib.php',
319 ),
4efa2483 320
ef22c1b6 321 // === user related functions ===
72f68b51 322
ef22c1b6 323 'moodle_user_create_users' => array(
5d1017e1
JM
324 'classname' => 'core_user_external',
325 'methodname' => 'create_users',
326 'classpath' => 'user/externallib.php',
327 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_create_users()',
328 'type' => 'write',
329 'capabilities'=> 'moodle/user:create',
330 ),
331
332 'core_user_create_users' => array(
333 'classname' => 'core_user_external',
ef22c1b6 334 'methodname' => 'create_users',
335 'classpath' => 'user/externallib.php',
fb79269b 336 'description' => 'Create users.',
337 'type' => 'write',
72f68b51 338 'capabilities'=> 'moodle/user:create',
ef22c1b6 339 ),
340
b0365ea5
JM
341 'core_user_get_users' => array(
342 'classname' => 'core_user_external',
343 'methodname' => 'get_users',
344 'classpath' => 'user/externallib.php',
345 'description' => 'search for users matching the parameters',
346 'type' => 'read',
347 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
348 ),
349
fb79269b 350 'moodle_user_get_users_by_id' => array(
5d1017e1
JM
351 'classname' => 'core_user_external',
352 'methodname' => 'get_users_by_id',
353 'classpath' => 'user/externallib.php',
354 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_users_by_id()',
355 'type' => 'read',
356 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
357 ),
358
c70b9853 359 'core_user_get_users_by_field' => array(
86477112 360 'classname' => 'core_user_external',
c70b9853 361 'methodname' => 'get_users_by_field',
86477112 362 'classpath' => 'user/externallib.php',
c70b9853 363 'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()',
86477112
FS
364 'type' => 'read',
365 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
366 ),
367
5d1017e1
JM
368 'core_user_get_users_by_id' => array(
369 'classname' => 'core_user_external',
fb79269b 370 'methodname' => 'get_users_by_id',
ef22c1b6 371 'classpath' => 'user/externallib.php',
41f5285f 372 '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 373 'type' => 'read',
b4c74367 374 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
ef22c1b6 375 ),
376
01479290 377 'moodle_user_get_users_by_courseid' => array(
5d1017e1
JM
378 'classname' => 'core_enrol_external',
379 'methodname' => 'get_enrolled_users',
380 'classpath' => 'enrol/externallib.php',
381 '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
382 'type' => 'read',
383 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
384 ),
385
ea4e96c2 386 'moodle_user_get_course_participants_by_id' => array(
5d1017e1
JM
387 'classname' => 'core_user_external',
388 'methodname' => 'get_course_user_profiles',
ea4e96c2 389 'classpath' => 'user/externallib.php',
5d1017e1
JM
390 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_course_user_profiles()',
391 'type' => 'read',
392 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
393 ),
394
395 'core_user_get_course_user_profiles' => array(
396 'classname' => 'core_user_external',
397 'methodname' => 'get_course_user_profiles',
398 'classpath' => 'user/externallib.php',
399 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
ea4e96c2
DC
400 'type' => 'read',
401 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
402 ),
403
ef22c1b6 404 'moodle_user_delete_users' => array(
5d1017e1
JM
405 'classname' => 'core_user_external',
406 'methodname' => 'delete_users',
407 'classpath' => 'user/externallib.php',
408 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_delete_users()',
409 'type' => 'write',
410 'capabilities'=> 'moodle/user:delete',
411 ),
412
413 'core_user_delete_users' => array(
414 'classname' => 'core_user_external',
ef22c1b6 415 'methodname' => 'delete_users',
416 'classpath' => 'user/externallib.php',
fb79269b 417 'description' => 'Delete users.',
418 'type' => 'write',
72f68b51 419 'capabilities'=> 'moodle/user:delete',
ef22c1b6 420 ),
421
422 'moodle_user_update_users' => array(
5d1017e1
JM
423 'classname' => 'core_user_external',
424 'methodname' => 'update_users',
425 'classpath' => 'user/externallib.php',
426 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_update_users()',
427 'type' => 'write',
428 'capabilities'=> 'moodle/user:update',
429 ),
430
431 'core_user_update_users' => array(
432 'classname' => 'core_user_external',
ef22c1b6 433 'methodname' => 'update_users',
434 'classpath' => 'user/externallib.php',
fb79269b 435 'description' => 'Update users.',
436 'type' => 'write',
72f68b51 437 'capabilities'=> 'moodle/user:update',
ef22c1b6 438 ),
e9b66095 439
72f68b51 440 // === enrol related functions ===
d0068cd0 441
b6b6c7ac
PC
442 'core_enrol_get_enrolled_users_with_capability' => array(
443 'classname' => 'core_enrol_external',
444 'methodname' => 'get_enrolled_users_with_capability',
445 'classpath' => 'enrol/externallib.php',
446 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
447 and have that capability',
448 'type' => 'read',
449 ),
72f68b51 450
df997f84
PS
451 'moodle_enrol_get_enrolled_users' => array(
452 'classname' => 'moodle_enrol_external',
453 'methodname' => 'get_enrolled_users',
454 'classpath' => 'enrol/externallib.php',
5d1017e1 455 '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 456 'type' => 'read',
72f68b51 457 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
458 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
df997f84 459 ),
e6acc551 460
5d1017e1
JM
461 'core_enrol_get_enrolled_users' => array(
462 'classname' => 'core_enrol_external',
463 'methodname' => 'get_enrolled_users',
464 'classpath' => 'enrol/externallib.php',
465 'description' => 'Get enrolled users by course id.',
466 'type' => 'read',
467 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
468 ),
df997f84 469
3364dbb5 470 'moodle_enrol_get_users_courses' => array(
5d1017e1 471 'classname' => 'core_enrol_external',
3364dbb5
PS
472 'methodname' => 'get_users_courses',
473 'classpath' => 'enrol/externallib.php',
5d1017e1 474 '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
475 'type' => 'read',
476 'capabilities'=> 'moodle/course:viewparticipants',
477 ),
478
5d1017e1
JM
479 'core_enrol_get_users_courses' => array(
480 'classname' => 'core_enrol_external',
481 'methodname' => 'get_users_courses',
482 'classpath' => 'enrol/externallib.php',
483 'description' => 'Get the list of courses where a user is enrolled in',
484 'type' => 'read',
485 'capabilities'=> 'moodle/course:viewparticipants',
486 ),
487
488 // === Role related functions ===
489
df997f84 490 'moodle_role_assign' => array(
5d1017e1
JM
491 'classname' => 'core_role_external',
492 'methodname' => 'assign_roles',
493 'classpath' => 'enrol/externallib.php',
494 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_assign_role()',
495 'type' => 'write',
496 'capabilities'=> 'moodle/role:assign',
497 ),
498
499 'core_role_assign_roles' => array(
500 'classname' => 'core_role_external',
501 'methodname' => 'assign_roles',
e9b66095 502 'classpath' => 'enrol/externallib.php',
df997f84 503 'description' => 'Manual role assignments.',
e9b66095 504 'type' => 'write',
72f68b51 505 'capabilities'=> 'moodle/role:assign',
e9b66095 506 ),
507
df997f84 508 'moodle_role_unassign' => array(
5d1017e1
JM
509 'classname' => 'core_role_external',
510 'methodname' => 'unassign_roles',
511 'classpath' => 'enrol/externallib.php',
512 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_unassign_role()',
513 'type' => 'write',
514 'capabilities'=> 'moodle/role:assign',
515 ),
516
517 'core_role_unassign_roles' => array(
518 'classname' => 'core_role_external',
519 'methodname' => 'unassign_roles',
e9b66095 520 'classpath' => 'enrol/externallib.php',
df997f84 521 'description' => 'Manual role unassignments.',
e9b66095 522 'type' => 'write',
72f68b51 523 'capabilities'=> 'moodle/role:assign',
e9b66095 524 ),
5b4a78e2 525
6bb31e40 526 // === course related functions ===
527
3ec163dd 528 'core_course_get_contents' => array(
d4a246bc 529 'classname' => 'core_course_external',
3ec163dd 530 'methodname' => 'get_course_contents',
d4a246bc 531 'classpath' => 'course/externallib.php',
3ec163dd 532 'description' => 'Get course contents',
d4a246bc 533 'type' => 'read',
3ec163dd 534 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
f2229c68 535 ),
d6ebe011 536
6bb31e40 537 'moodle_course_get_courses' => array(
5d1017e1
JM
538 'classname' => 'core_course_external',
539 'methodname' => 'get_courses',
540 'classpath' => 'course/externallib.php',
541 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_get_courses()',
542 'type' => 'read',
543 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
544 ),
545
546 'core_course_get_courses' => array(
547 'classname' => 'core_course_external',
6bb31e40 548 'methodname' => 'get_courses',
549 'classpath' => 'course/externallib.php',
550 'description' => 'Return course details',
551 'type' => 'read',
552 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
553 ),
554
555 'moodle_course_create_courses' => array(
5d1017e1
JM
556 'classname' => 'core_course_external',
557 'methodname' => 'create_courses',
558 'classpath' => 'course/externallib.php',
559 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_create_courses()',
560 'type' => 'write',
561 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
562 ),
563
564 'core_course_create_courses' => array(
565 'classname' => 'core_course_external',
6bb31e40 566 'methodname' => 'create_courses',
567 'classpath' => 'course/externallib.php',
568 'description' => 'Create new courses',
569 'type' => 'write',
570 'capabilities'=> 'moodle/course:create,moodle/course:visibility',
571 ),
572
63a85dc7
JL
573 'core_course_delete_courses' => array(
574 'classname' => 'core_course_external',
575 'methodname' => 'delete_courses',
576 'classpath' => 'course/externallib.php',
577 'description' => 'Deletes all specified courses',
578 'type' => 'write',
579 'capabilities'=> 'moodle/course:delete',
580 ),
581
79949c1b
MN
582 'core_course_delete_modules' => array(
583 'classname' => 'core_course_external',
584 'methodname' => 'delete_modules',
585 'classpath' => 'course/externallib.php',
586 'description' => 'Deletes all specified module instances',
587 'type' => 'write',
588 'capabilities' => 'moodle/course:manageactivities'
589 ),
590
3dc1d76e
JL
591 'core_course_duplicate_course' => array(
592 'classname' => 'core_course_external',
593 'methodname' => 'duplicate_course',
594 'classpath' => 'course/externallib.php',
595 'description' => 'Duplicate an existing course (creating a new one) without user data',
596 'type' => 'write',
597 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
598 ),
599
791723c3
RT
600 'core_course_update_courses' => array(
601 'classname' => 'core_course_external',
602 'methodname' => 'update_courses',
603 'classpath' => 'course/externallib.php',
604 'description' => 'Update courses',
605 'type' => 'write',
606 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
607 ),
608
3ec163dd
EL
609 // === course category related functions ===
610
611 'core_course_get_categories' => array(
612 'classname' => 'core_course_external',
613 'methodname' => 'get_categories',
614 'classpath' => 'course/externallib.php',
615 'description' => 'Return category details',
616 'type' => 'read',
617 'capabilities'=> 'moodle/category:viewhiddencategories',
618 ),
619
479a5db1
FS
620 'core_course_create_categories' => array(
621 'classname' => 'core_course_external',
622 'methodname' => 'create_categories',
623 'classpath' => 'course/externallib.php',
624 'description' => 'Create course categories',
625 'type' => 'write',
626 'capabilities'=> 'moodle/category:manage',
627 ),
d6ebe011 628
3ec163dd
EL
629 'core_course_update_categories' => array(
630 'classname' => 'core_course_external',
631 'methodname' => 'update_categories',
632 'classpath' => 'course/externallib.php',
633 'description' => 'Update categories',
634 'type' => 'write',
afe27edc 635 'capabilities'=> 'moodle/category:manage',
3ec163dd
EL
636 ),
637
2f951d86
FS
638 'core_course_delete_categories' => array(
639 'classname' => 'core_course_external',
640 'methodname' => 'delete_categories',
641 'classpath' => 'course/externallib.php',
642 'description' => 'Delete course categories',
643 'type' => 'write',
644 'capabilities'=> 'moodle/category:manage',
645 ),
479a5db1 646
8430d87b
JL
647 'core_course_import_course' => array(
648 'classname' => 'core_course_external',
649 'methodname' => 'import_course',
650 'classpath' => 'course/externallib.php',
651 'description' => 'Import course data from a course into another course. Does not include any user data.',
652 'type' => 'write',
653 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
654 ),
655
a623b6b8
JM
656 // === message related functions ===
657
4de00da7 658 'moodle_message_send_instantmessages' => array(
5d1017e1
JM
659 'classname' => 'core_message_external',
660 'methodname' => 'send_instant_messages',
661 'classpath' => 'message/externallib.php',
662 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_message_send_instant_messages()',
663 'type' => 'write',
664 'capabilities'=> 'moodle/site:sendmessage',
665 ),
666
667 'core_message_send_instant_messages' => array(
668 'classname' => 'core_message_external',
669 'methodname' => 'send_instant_messages',
a623b6b8 670 'classpath' => 'message/externallib.php',
4de00da7 671 'description' => 'Send instant messages',
a623b6b8
JM
672 'type' => 'write',
673 'capabilities'=> 'moodle/site:sendmessage',
674 ),
675
d6731600
FM
676 'core_message_create_contacts' => array(
677 'classname' => 'core_message_external',
678 'methodname' => 'create_contacts',
679 'classpath' => 'message/externallib.php',
680 'description' => 'Add contacts to the contact list',
681 'type' => 'write',
682 'capabilities'=> '',
683 ),
684
685 'core_message_delete_contacts' => array(
686 'classname' => 'core_message_external',
687 'methodname' => 'delete_contacts',
688 'classpath' => 'message/externallib.php',
689 'description' => 'Remove contacts from the contact list',
690 'type' => 'write',
691 'capabilities'=> '',
692 ),
693
694 'core_message_block_contacts' => array(
695 'classname' => 'core_message_external',
696 'methodname' => 'block_contacts',
697 'classpath' => 'message/externallib.php',
698 'description' => 'Block contacts',
699 'type' => 'write',
700 'capabilities'=> '',
701 ),
702
703 'core_message_unblock_contacts' => array(
704 'classname' => 'core_message_external',
705 'methodname' => 'unblock_contacts',
706 'classpath' => 'message/externallib.php',
707 'description' => 'Unblock contacts',
708 'type' => 'write',
709 'capabilities'=> '',
710 ),
711
712 'core_message_get_contacts' => array(
713 'classname' => 'core_message_external',
714 'methodname' => 'get_contacts',
715 'classpath' => 'message/externallib.php',
716 'description' => 'Retrieve the contact list',
717 'type' => 'read',
718 'capabilities'=> '',
719 ),
720
721 'core_message_search_contacts' => array(
722 'classname' => 'core_message_external',
723 'methodname' => 'search_contacts',
724 'classpath' => 'message/externallib.php',
725 'description' => 'Search for contacts',
726 'type' => 'read',
727 'capabilities'=> '',
728 ),
729
8d46dabb
JM
730 // === notes related functions ===
731
732 'moodle_notes_create_notes' => array(
5d1017e1
JM
733 'classname' => 'core_notes_external',
734 'methodname' => 'create_notes',
735 'classpath' => 'notes/externallib.php',
736 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_notes_create_notes()',
737 'type' => 'write',
738 'capabilities'=> 'moodle/notes:manage',
739 ),
740
741 'core_notes_create_notes' => array(
742 'classname' => 'core_notes_external',
8d46dabb
JM
743 'methodname' => 'create_notes',
744 'classpath' => 'notes/externallib.php',
745 'description' => 'Create notes',
746 'type' => 'write',
747 'capabilities'=> 'moodle/notes:manage',
748 ),
749
34348b2b
JF
750 'core_notes_delete_notes' => array(
751 'classname' => 'core_notes_external',
752 'methodname' => 'delete_notes',
753 'classpath' => 'notes/externallib.php',
754 'description' => 'Delete notes',
755 'type' => 'write',
756 'capabilities'=> 'moodle/notes:manage',
757 ),
758
759 'core_notes_get_notes' => array(
760 'classname' => 'core_notes_external',
761 'methodname' => 'get_notes',
762 'classpath' => 'notes/externallib.php',
763 'description' => 'Get notes',
764 'type' => 'read',
765 'capabilities'=> 'moodle/notes:view',
766 ),
767
768 'core_notes_update_notes' => array(
769 'classname' => 'core_notes_external',
770 'methodname' => 'update_notes',
771 'classpath' => 'notes/externallib.php',
772 'description' => 'Update notes',
773 'type' => 'write',
774 'capabilities'=> 'moodle/notes:manage',
775 ),
776
3f0ea6d8
PC
777 // === grade related functions ===
778
779 'core_grade_get_definitions' => array(
780 'classname' => 'core_grade_external',
781 'methodname' => 'get_definitions',
782 'classpath' => 'grade/externallib.php',
783 'description' => 'Get grading definitions',
784 'type' => 'read'
785 ),
786
0bf486a6
JM
787 // === webservice related functions ===
788
789 'moodle_webservice_get_siteinfo' => array(
5d1017e1
JM
790 'classname' => 'core_webservice_external',
791 'methodname' => 'get_site_info',
792 'classpath' => 'webservice/externallib.php',
793 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_webservice_get_site_info()',
794 'type' => 'read',
795 ),
796
797 'core_webservice_get_site_info' => array(
798 'classname' => 'core_webservice_external',
799 'methodname' => 'get_site_info',
0bf486a6
JM
800 'classpath' => 'webservice/externallib.php',
801 'description' => 'Return some site info / user info / list web service functions',
802 'type' => 'read',
803 ),
804
11e76602
JM
805 'core_get_string' => array(
806 'classname' => 'core_external',
807 'methodname' => 'get_string',
808 'classpath' => 'lib/external/externallib.php',
809 'description' => 'Return a translated string - similar to core get_string() call',
810 'type' => 'read',
811 ),
812
813 'core_get_strings' => array(
814 'classname' => 'core_external',
815 'methodname' => 'get_strings',
816 'classpath' => 'lib/external/externallib.php',
817 'description' => 'Return some translated strings - like several core get_string() calls',
818 'type' => 'read',
819 ),
820
821 'core_get_component_strings' => array(
822 'classname' => 'core_external',
823 'methodname' => 'get_component_strings',
824 'classpath' => 'lib/external/externallib.php',
825 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
826 - similar to core get_component_strings() call',
827 'type' => 'read',
828 ),
5e1350ab
AA
829
830
831 // === Calendar related functions ===
832
833 'core_calendar_delete_calendar_events' => array(
834 'classname' => 'core_calendar_external',
835 'methodname' => 'delete_calendar_events',
836 'description' => 'Delete calendar events',
837 'classpath' => 'calendar/externallib.php',
838 'type' => 'write',
839 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
840 ),
841
793d3855
AA
842
843 'core_calendar_get_calendar_events' => array(
844 'classname' => 'core_calendar_external',
845 'methodname' => 'get_calendar_events',
846 'description' => 'Get calendar events',
847 'classpath' => 'calendar/externallib.php',
848 'type' => 'read',
849 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
850 ),
851
c66dc3df
AA
852 'core_calendar_create_calendar_events' => array(
853 'classname' => 'core_calendar_external',
854 'methodname' => 'create_calendar_events',
855 'description' => 'Create calendar events',
856 'classpath' => 'calendar/externallib.php',
857 'type' => 'write',
858 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
859 ),
9a0df45a 860);
c1b65883
JM
861
862$services = array(
96e0194c
SH
863 'Moodle mobile web service' => array(
864 'functions' => array (
865 'moodle_enrol_get_users_courses',
866 'moodle_enrol_get_enrolled_users',
f2806b9a
JM
867 'moodle_user_get_users_by_id',
868 'moodle_webservice_get_siteinfo',
869 'moodle_notes_create_notes',
ea4e96c2 870 'moodle_user_get_course_participants_by_id',
01479290 871 'moodle_user_get_users_by_courseid',
ec0d6ea2 872 'moodle_message_send_instantmessages',
11e76602
JM
873 'core_course_get_contents',
874 'core_get_component_strings'),
96e0194c
SH
875 'enabled' => 0,
876 'restrictedusers' => 0,
af03513f
JM
877 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
878 'downloadfiles' => 1
96e0194c
SH
879 ),
880);