weekly release 2.3dev
[moodle.git] / lib / db / services.php
... / ...
CommitLineData
1<?php
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
17
18/**
19 * Core external functions and service definitions.
20 *
21 * @package core_webservice
22 * @category webservice
23 * @copyright 2009 Petr Skodak
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 */
26
27$functions = array(
28
29 // === group related functions ===
30
31 'moodle_group_create_groups' => array(
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',
42 'methodname' => 'create_groups',
43 'classpath' => 'group/externallib.php',
44 'description' => 'Creates new groups.',
45 'type' => 'write',
46 'capabilities'=> 'moodle/course:managegroups',
47 ),
48
49 'moodle_group_get_groups' => array(
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',
60 'methodname' => 'get_groups',
61 'classpath' => 'group/externallib.php',
62 'description' => 'Returns group details.',
63 'type' => 'read',
64 'capabilities'=> 'moodle/course:managegroups',
65 ),
66
67 'moodle_group_get_course_groups' => array(
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',
78 'methodname' => 'get_course_groups',
79 'classpath' => 'group/externallib.php',
80 'description' => 'Returns all groups in specified course.',
81 'type' => 'read',
82 'capabilities'=> 'moodle/course:managegroups',
83 ),
84
85 'moodle_group_delete_groups' => array(
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',
96 'methodname' => 'delete_groups',
97 'classpath' => 'group/externallib.php',
98 'description' => 'Deletes all specified groups.',
99 'type' => 'delete',
100 'capabilities'=> 'moodle/course:managegroups',
101 ),
102
103 'moodle_group_get_groupmembers' => array(
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',
115 'classpath' => 'group/externallib.php',
116 'description' => 'Returns group members.',
117 'type' => 'read',
118 'capabilities'=> 'moodle/course:managegroups',
119 ),
120
121 'moodle_group_add_groupmembers' => array(
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',
133 'classpath' => 'group/externallib.php',
134 'description' => 'Adds group members.',
135 'type' => 'write',
136 'capabilities'=> 'moodle/course:managegroups',
137 ),
138
139 'moodle_group_delete_groupmembers' => array(
140 'classname' => 'core_group_external',
141 'methodname' => 'delete_group_members',
142 'classpath' => 'group/externallib.php',
143 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_group_members()',
144 'type' => 'delete',
145 'capabilities'=> 'moodle/course:managegroups',
146 ),
147
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 ),
156
157 // === file related functions ===
158
159 'moodle_file_get_files' => array(
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',
169 'methodname' => 'get_files',
170 'description' => 'browse moodle files',
171 'type' => 'read',
172 'classpath' => 'files/externallib.php',
173 ),
174
175 'moodle_file_upload' => array(
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',
185 'methodname' => 'upload',
186 'description' => 'upload a file to moodle',
187 'type' => 'write',
188 'classpath' => 'files/externallib.php',
189 ),
190
191 // === user related functions ===
192
193 'moodle_user_create_users' => array(
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',
204 'methodname' => 'create_users',
205 'classpath' => 'user/externallib.php',
206 'description' => 'Create users.',
207 'type' => 'write',
208 'capabilities'=> 'moodle/user:create',
209 ),
210
211 'moodle_user_get_users_by_id' => array(
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',
222 'methodname' => 'get_users_by_id',
223 'classpath' => 'user/externallib.php',
224 'description' => 'Get users by id.',
225 'type' => 'read',
226 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
227 ),
228
229 'moodle_user_get_users_by_courseid' => array(
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()',
234 'type' => 'read',
235 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
236 ),
237
238 'moodle_user_get_course_participants_by_id' => array(
239 'classname' => 'core_user_external',
240 'methodname' => 'get_course_user_profiles',
241 'classpath' => 'user/externallib.php',
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).',
252 'type' => 'read',
253 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
254 ),
255
256 'moodle_user_delete_users' => array(
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',
267 'methodname' => 'delete_users',
268 'classpath' => 'user/externallib.php',
269 'description' => 'Delete users.',
270 'type' => 'write',
271 'capabilities'=> 'moodle/user:delete',
272 ),
273
274 'moodle_user_update_users' => array(
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',
285 'methodname' => 'update_users',
286 'classpath' => 'user/externallib.php',
287 'description' => 'Update users.',
288 'type' => 'write',
289 'capabilities'=> 'moodle/user:update',
290 ),
291
292 // === enrol related functions ===
293
294 'moodle_enrol_get_enrolled_users' => array(
295 'classname' => 'moodle_enrol_external',
296 'methodname' => 'get_enrolled_users',
297 'classpath' => 'enrol/externallib.php',
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).',
299 'type' => 'read',
300 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
301 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
302 ),
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 ),
312
313 'moodle_enrol_get_users_courses' => array(
314 'classname' => 'core_enrol_external',
315 'methodname' => 'get_users_courses',
316 'classpath' => 'enrol/externallib.php',
317 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_users_courses()',
318 'type' => 'read',
319 'capabilities'=> 'moodle/course:viewparticipants',
320 ),
321
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
333 'moodle_role_assign' => array(
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',
345 'classpath' => 'enrol/externallib.php',
346 'description' => 'Manual role assignments.',
347 'type' => 'write',
348 'capabilities'=> 'moodle/role:assign',
349 ),
350
351 'moodle_role_unassign' => array(
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',
363 'classpath' => 'enrol/externallib.php',
364 'description' => 'Manual role unassignments.',
365 'type' => 'write',
366 'capabilities'=> 'moodle/role:assign',
367 ),
368
369 // === course related functions ===
370
371 'moodle_course_get_courses' => array(
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',
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(
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',
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
407 'core_course_get_contents' => array(
408 'classname' => 'core_course_external',
409 'methodname' => 'get_course_contents',
410 'classpath' => 'course/externallib.php',
411 'description' => 'Get course contents',
412 'type' => 'read',
413 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
414 ),
415
416 // === message related functions ===
417
418 'moodle_message_send_instantmessages' => array(
419 'classname' => 'core_message_external',
420 'methodname' => 'send_instant_messages',
421 'classpath' => 'message/externallib.php',
422 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_message_send_instant_messages()',
423 'type' => 'write',
424 'capabilities'=> 'moodle/site:sendmessage',
425 ),
426
427 'core_message_send_instant_messages' => array(
428 'classname' => 'core_message_external',
429 'methodname' => 'send_instant_messages',
430 'classpath' => 'message/externallib.php',
431 'description' => 'Send instant messages',
432 'type' => 'write',
433 'capabilities'=> 'moodle/site:sendmessage',
434 ),
435
436 // === notes related functions ===
437
438 'moodle_notes_create_notes' => array(
439 'classname' => 'core_notes_external',
440 'methodname' => 'create_notes',
441 'classpath' => 'notes/externallib.php',
442 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_notes_create_notes()',
443 'type' => 'write',
444 'capabilities'=> 'moodle/notes:manage',
445 ),
446
447 'core_notes_create_notes' => array(
448 'classname' => 'core_notes_external',
449 'methodname' => 'create_notes',
450 'classpath' => 'notes/externallib.php',
451 'description' => 'Create notes',
452 'type' => 'write',
453 'capabilities'=> 'moodle/notes:manage',
454 ),
455
456 // === webservice related functions ===
457
458 'moodle_webservice_get_siteinfo' => array(
459 'classname' => 'core_webservice_external',
460 'methodname' => 'get_site_info',
461 'classpath' => 'webservice/externallib.php',
462 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_webservice_get_site_info()',
463 'type' => 'read',
464 ),
465
466 'core_webservice_get_site_info' => array(
467 'classname' => 'core_webservice_external',
468 'methodname' => 'get_site_info',
469 'classpath' => 'webservice/externallib.php',
470 'description' => 'Return some site info / user info / list web service functions',
471 'type' => 'read',
472 ),
473
474);
475
476$services = array(
477 'Moodle mobile web service' => array(
478 'functions' => array (
479 'moodle_enrol_get_users_courses',
480 'moodle_enrol_get_enrolled_users',
481 'moodle_user_get_users_by_id',
482 'moodle_webservice_get_siteinfo',
483 'moodle_notes_create_notes',
484 'moodle_user_get_course_participants_by_id',
485 'moodle_user_get_users_by_courseid',
486 'moodle_message_send_instantmessages',
487 'core_course_get_contents'),
488 'enabled' => 0,
489 'restrictedusers' => 0,
490 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
491 'downloadfiles' => 1
492 ),
493);