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