services.php 40.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

17

18
19
20
/**
 * Core external functions and service definitions.
 *
21
22
23
24
25
26
27
28
29
 * The functions and services defined on this file are
 * processed and registered into the Moodle DB after any
 * install or upgrade operation. All plugins support this.
 *
 * For more information, take a look to the documentation available:
 *     - Webservices API: {@link http://docs.moodle.org/dev/Web_services_API}
 *     - External API: {@link http://docs.moodle.org/dev/External_functions_API}
 *     - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}
 *
30
31
32
 * @package    core_webservice
 * @category   webservice
 * @copyright  2009 Petr Skodak
33
34
35
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

$functions = array(
37

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    // Cohort related functions.

    'core_cohort_create_cohorts' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'create_cohorts',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Creates new cohorts.',
        'type'        => 'write',
        'capabilities'=> 'moodle/cohort:manage',
    ),

    'core_cohort_delete_cohorts' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'delete_cohorts',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Deletes all specified cohorts.',
        'type'        => 'delete',
        'capabilities'=> 'moodle/cohort:manage',
    ),

    'core_cohort_get_cohorts' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'get_cohorts',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Returns cohort details.',
        'type'        => 'read',
        'capabilities'=> 'moodle/cohort:view',
    ),

    'core_cohort_update_cohorts' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'update_cohorts',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Updates existing cohorts.',
        'type'        => 'write',
        'capabilities'=> 'moodle/cohort:manage',
    ),

    'core_cohort_add_cohort_members' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'add_cohort_members',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Adds cohort members.',
        'type'        => 'write',
        'capabilities'=> 'moodle/cohort:assign',
    ),

    'core_cohort_delete_cohort_members' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'delete_cohort_members',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Deletes cohort members.',
        'type'        => 'delete',
        'capabilities'=> 'moodle/cohort:assign',
    ),

    'core_cohort_get_cohort_members' => array(
        'classname'   => 'core_cohort_external',
        'methodname'  => 'get_cohort_members',
        'classpath'   => 'cohort/externallib.php',
        'description' => 'Returns cohort members.',
        'type'        => 'read',
        'capabilities'=> 'moodle/cohort:view',
    ),
102
    // Grade related functions.
103

104
105
106
    'core_grades_get_grades' => array(
        'classname'     => 'core_grades_external',
        'methodname'    => 'get_grades',
107
108
109
        'description'   => 'Returns student course total grade and grades for activities.
                                This function does not return category or manual items.
                                This function is suitable for managers or teachers not students.',
110
        'type'          => 'read',
111
        'capabilities'  => 'moodle/grade:view, moodle/grade:viewall, moodle/grade:viewhidden',
112
113
    ),

114
115
116
117
118
119
    'core_grades_update_grades' => array(
        'classname'     => 'core_grades_external',
        'methodname'    => 'update_grades',
        'description'   => 'Update a grade item and associated student grades.',
        'type'          => 'write',
        'capabilities'  => '',
120
    ),
121

122
    // === group related functions ===
123

124
    'moodle_group_create_groups' => array(
125
126
127
128
129
130
131
132
133
134
        'classname'   => 'core_group_external',
        'methodname'  => 'create_groups',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_create_groups(). ',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_create_groups' => array(
        'classname'   => 'core_group_external',
135
136
        'methodname'  => 'create_groups',
        'classpath'   => 'group/externallib.php',
137
138
        'description' => 'Creates new groups.',
        'type'        => 'write',
139
        'capabilities'=> 'moodle/course:managegroups',
140
    ),
141

142
    'moodle_group_get_groups' => array(
143
144
145
146
147
148
149
150
151
152
        'classname'   => 'core_group_external',
        'methodname'  => 'get_groups',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_groups()',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_get_groups' => array(
        'classname'   => 'core_group_external',
153
154
        'methodname'  => 'get_groups',
        'classpath'   => 'group/externallib.php',
155
        'description' => 'Returns group details.',
156
        'type'        => 'read',
157
        'capabilities'=> 'moodle/course:managegroups',
158
    ),
159
160

    'moodle_group_get_course_groups' => array(
161
162
163
164
165
166
167
168
169
170
        'classname'   => 'core_group_external',
        'methodname'  => 'get_course_groups',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_course_groups()',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_get_course_groups' => array(
        'classname'   => 'core_group_external',
171
172
173
174
        'methodname'  => 'get_course_groups',
        'classpath'   => 'group/externallib.php',
        'description' => 'Returns all groups in specified course.',
        'type'        => 'read',
175
        'capabilities'=> 'moodle/course:managegroups',
176
    ),
177

178
    'moodle_group_delete_groups' => array(
179
180
181
182
183
184
185
186
187
188
        'classname'   => 'core_group_external',
        'methodname'  => 'delete_groups',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_groups()',
        'type'        => 'delete',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_delete_groups' => array(
        'classname'   => 'core_group_external',
189
190
        'methodname'  => 'delete_groups',
        'classpath'   => 'group/externallib.php',
191
192
        'description' => 'Deletes all specified groups.',
        'type'        => 'delete',
193
        'capabilities'=> 'moodle/course:managegroups',
194
    ),
195

196
    'moodle_group_get_groupmembers' => array(
197
198
199
200
201
202
203
204
205
206
207
        'classname'   => 'core_group_external',
        'methodname'  => 'get_group_members',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_get_group_members()',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_get_group_members' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'get_group_members',
208
        'classpath'   => 'group/externallib.php',
209
210
        'description' => 'Returns group members.',
        'type'        => 'read',
211
        'capabilities'=> 'moodle/course:managegroups',
212
    ),
213

214
    'moodle_group_add_groupmembers' => array(
215
216
217
218
219
220
221
222
223
224
225
        'classname'   => 'core_group_external',
        'methodname'  => 'add_group_members',
        'classpath'   => 'group/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_add_group_members()',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:managegroups',
    ),

    'core_group_add_group_members' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'add_group_members',
226
        'classpath'   => 'group/externallib.php',
227
228
        'description' => 'Adds group members.',
        'type'        => 'write',
229
        'capabilities'=> 'moodle/course:managegroups',
230
231
232
    ),

    'moodle_group_delete_groupmembers' => array(
233
234
        'classname'   => 'core_group_external',
        'methodname'  => 'delete_group_members',
235
        'classpath'   => 'group/externallib.php',
236
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_group_delete_group_members()',
237
        'type'        => 'delete',
238
        'capabilities'=> 'moodle/course:managegroups',
239
    ),
240

241
242
243
244
245
246
247
248
    'core_group_delete_group_members' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'delete_group_members',
        'classpath'   => 'group/externallib.php',
        'description' => 'Deletes group members.',
        'type'        => 'delete',
        'capabilities'=> 'moodle/course:managegroups',
    ),
249

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
    'core_group_create_groupings' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'create_groupings',
        'classpath'   => 'group/externallib.php',
        'description' => 'Creates new groupings',
        'type'        => 'write',
    ),

    'core_group_update_groupings' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'update_groupings',
        'classpath'   => 'group/externallib.php',
        'description' => 'Updates existing groupings',
        'type'        => 'write',
    ),

    'core_group_get_groupings' => array(
        'classname'   => 'core_group_external',
        'methodname'  => 'get_groupings',
        'classpath'   => 'group/externallib.php',
        'description' => 'Returns groupings details.',
        'type'        => 'read',
    ),

    'core_group_get_course_groupings' => array(
Juan Leyva's avatar
Juan Leyva committed
275
276
277
278
279
        'classname'   => 'core_group_external',
        'methodname'  => 'get_course_groupings',
        'classpath'   => 'group/externallib.php',
        'description' => 'Returns all groupings in specified course.',
        'type'        => 'read',
280
281
282
    ),

    'core_group_delete_groupings' => array(
Juan Leyva's avatar
Juan Leyva committed
283
284
285
286
287
        'classname'   => 'core_group_external',
        'methodname'  => 'delete_groupings',
        'classpath'   => 'group/externallib.php',
        'description' => 'Deletes all specified groupings.',
        'type'        => 'write',
288
289
290
    ),

    'core_group_assign_grouping' => array(
Juan Leyva's avatar
Juan Leyva committed
291
292
293
294
295
        'classname'   => 'core_group_external',
        'methodname'  => 'assign_grouping',
        'classpath'   => 'group/externallib.php',
        'description' => 'Assing groups from groupings',
        'type'        => 'write',
296
297
298
    ),

    'core_group_unassign_grouping' => array(
Juan Leyva's avatar
Juan Leyva committed
299
300
301
302
303
        'classname'   => 'core_group_external',
        'methodname'  => 'unassign_grouping',
        'classpath'   => 'group/externallib.php',
        'description' => 'Unassing groups from groupings',
        'type'        => 'write',
304
305
    ),

306
307
    // === file related functions ===

308
    'moodle_file_get_files' => array(
309
310
311
312
313
314
315
316
317
        'classname'   => 'core_files_external',
        'methodname'  => 'get_files',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_get_files()',
        'type'        => 'read',
        'classpath'   => 'files/externallib.php',
    ),

    'core_files_get_files' => array(
        'classname'   => 'core_files_external',
318
319
320
321
322
        'methodname'  => 'get_files',
        'description' => 'browse moodle files',
        'type'        => 'read',
        'classpath'   => 'files/externallib.php',
    ),
323

324
    'moodle_file_upload' => array(
325
326
327
328
329
330
331
332
333
        'classname'   => 'core_files_external',
        'methodname'  => 'upload',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_files_upload()',
        'type'        => 'write',
        'classpath'   => 'files/externallib.php',
    ),

    'core_files_upload' => array(
        'classname'   => 'core_files_external',
334
335
336
337
338
        'methodname'  => 'upload',
        'description' => 'upload a file to moodle',
        'type'        => 'write',
        'classpath'   => 'files/externallib.php',
    ),
339

340
    // === user related functions ===
341

342
    'moodle_user_create_users' => array(
343
344
345
346
347
348
349
350
351
352
        'classname'   => 'core_user_external',
        'methodname'  => 'create_users',
        'classpath'   => 'user/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_create_users()',
        'type'        => 'write',
        'capabilities'=> 'moodle/user:create',
    ),

    'core_user_create_users' => array(
        'classname'   => 'core_user_external',
353
354
        'methodname'  => 'create_users',
        'classpath'   => 'user/externallib.php',
355
356
        'description' => 'Create users.',
        'type'        => 'write',
357
        'capabilities'=> 'moodle/user:create',
358
359
    ),

360
361
362
363
364
365
366
367
368
    'core_user_get_users' => array(
        'classname'   => 'core_user_external',
        'methodname'  => 'get_users',
        'classpath'   => 'user/externallib.php',
        'description' => 'search for users matching the parameters',
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
    ),

369
    'moodle_user_get_users_by_id' => array(
370
371
372
373
374
375
376
377
        'classname'   => 'core_user_external',
        'methodname'  => 'get_users_by_id',
        'classpath'   => 'user/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_users_by_id()',
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
    ),

378
    'core_user_get_users_by_field' => array(
379
        'classname'   => 'core_user_external',
380
        'methodname'  => 'get_users_by_field',
381
        'classpath'   => 'user/externallib.php',
382
        'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()',
383
384
385
386
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
    ),

387
388
    'core_user_get_users_by_id' => array(
        'classname'   => 'core_user_external',
389
        'methodname'  => 'get_users_by_id',
390
        'classpath'   => 'user/externallib.php',
391
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been replaced by core_user_get_users_by_field()',
392
        'type'        => 'read',
393
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update',
394
395
    ),

396
    'moodle_user_get_users_by_courseid' => array(
397
398
399
400
        'classname'   => 'core_enrol_external',
        'methodname'  => 'get_enrolled_users',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_enrolled_users()',
401
402
403
404
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
    ),

Dongsheng Cai's avatar
Dongsheng Cai committed
405
    'moodle_user_get_course_participants_by_id' => array(
406
407
        'classname'   => 'core_user_external',
        'methodname'  => 'get_course_user_profiles',
Dongsheng Cai's avatar
Dongsheng Cai committed
408
        'classpath'   => 'user/externallib.php',
409
410
411
412
413
414
415
416
417
418
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_get_course_user_profiles()',
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
    ),

    'core_user_get_course_user_profiles' => array(
        'classname'   => 'core_user_external',
        'methodname'  => 'get_course_user_profiles',
        'classpath'   => 'user/externallib.php',
        'description' => 'Get course user profiles (each of the profils matching a course id and a user id).',
Dongsheng Cai's avatar
Dongsheng Cai committed
419
420
421
422
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
    ),

423
    'moodle_user_delete_users' => array(
424
425
426
427
428
429
430
431
432
433
        'classname'   => 'core_user_external',
        'methodname'  => 'delete_users',
        'classpath'   => 'user/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_delete_users()',
        'type'        => 'write',
        'capabilities'=> 'moodle/user:delete',
    ),

    'core_user_delete_users' => array(
        'classname'   => 'core_user_external',
434
435
        'methodname'  => 'delete_users',
        'classpath'   => 'user/externallib.php',
436
437
        'description' => 'Delete users.',
        'type'        => 'write',
438
        'capabilities'=> 'moodle/user:delete',
439
440
441
    ),

    'moodle_user_update_users' => array(
442
443
444
445
446
447
448
449
450
451
        'classname'   => 'core_user_external',
        'methodname'  => 'update_users',
        'classpath'   => 'user/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_user_update_users()',
        'type'        => 'write',
        'capabilities'=> 'moodle/user:update',
    ),

    'core_user_update_users' => array(
        'classname'   => 'core_user_external',
452
453
        'methodname'  => 'update_users',
        'classpath'   => 'user/externallib.php',
454
455
        'description' => 'Update users.',
        'type'        => 'write',
456
        'capabilities'=> 'moodle/user:update',
457
    ),
458

459
460
461
462
463
464
465
466
467
    'core_user_add_user_device' => array(
        'classname'   => 'core_user_external',
        'methodname'  => 'add_user_device',
        'classpath'   => 'user/externallib.php',
        'description' => 'Store mobile user devices information for PUSH Notifications.',
        'type'        => 'write',
        'capabilities'=> '',
    ),

468
469
470
471
472
473
474
475
476
    'core_user_add_user_private_files' => array(
        'classname'     => 'core_user_external',
        'methodname'    => 'add_user_private_files',
        'classpath'     => 'user/externallib.php',
        'description'   => 'Copy files from a draft area to users private files area.',
        'type'          => 'write',
        'capabilities'  => 'moodle/user:manageownfiles',
    ),

477
    // === enrol related functions ===
478

479
480
481
482
483
484
485
486
    'core_enrol_get_enrolled_users_with_capability' => array(
        'classname'   => 'core_enrol_external',
        'methodname'  => 'get_enrolled_users_with_capability',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course
                          and have that capability',
        'type'        => 'read',
    ),
487

488
489
490
491
    'moodle_enrol_get_enrolled_users' => array(
        'classname'   => 'moodle_enrol_external',
        'methodname'  => 'get_enrolled_users',
        'classpath'   => 'enrol/externallib.php',
492
        '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).',
493
        'type'        => 'read',
494
495
        'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants,
            moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview',
496
    ),
Sam Hemelryk's avatar
Sam Hemelryk committed
497

498
499
500
501
502
503
504
505
    'core_enrol_get_enrolled_users' => array(
        'classname'   => 'core_enrol_external',
        'methodname'  => 'get_enrolled_users',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'Get enrolled users by course id.',
        'type'        => 'read',
        'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups',
    ),
506

507
    'moodle_enrol_get_users_courses' => array(
508
        'classname'   => 'core_enrol_external',
509
510
        'methodname'  => 'get_users_courses',
        'classpath'   => 'enrol/externallib.php',
511
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_enrol_get_users_courses()',
512
513
514
515
        'type'        => 'read',
        'capabilities'=> 'moodle/course:viewparticipants',
    ),

516
517
518
519
520
521
522
523
524
    'core_enrol_get_users_courses' => array(
        'classname'   => 'core_enrol_external',
        'methodname'  => 'get_users_courses',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'Get the list of courses where a user is enrolled in',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:viewparticipants',
    ),

525
526
527
528
529
530
531
532
    'core_enrol_get_course_enrolment_methods' => array(
        'classname'   => 'core_enrol_external',
        'methodname'  => 'get_course_enrolment_methods',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'Get the list of course enrolment methods',
        'type'        => 'read',
    ),

533
534
    // === Role related functions ===

535
    'moodle_role_assign' => array(
536
537
538
539
540
541
542
543
544
545
546
        'classname'   => 'core_role_external',
        'methodname'  => 'assign_roles',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_assign_role()',
        'type'        => 'write',
        'capabilities'=> 'moodle/role:assign',
    ),

    'core_role_assign_roles' => array(
        'classname'   => 'core_role_external',
        'methodname'  => 'assign_roles',
547
        'classpath'   => 'enrol/externallib.php',
548
        'description' => 'Manual role assignments.',
549
        'type'        => 'write',
550
        'capabilities'=> 'moodle/role:assign',
551
552
    ),

553
    'moodle_role_unassign' => array(
554
555
556
557
558
559
560
561
562
563
564
        'classname'   => 'core_role_external',
        'methodname'  => 'unassign_roles',
        'classpath'   => 'enrol/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_role_unassign_role()',
        'type'        => 'write',
        'capabilities'=> 'moodle/role:assign',
    ),

    'core_role_unassign_roles' => array(
        'classname'   => 'core_role_external',
        'methodname'  => 'unassign_roles',
565
        'classpath'   => 'enrol/externallib.php',
566
        'description' => 'Manual role unassignments.',
567
        'type'        => 'write',
568
        'capabilities'=> 'moodle/role:assign',
569
    ),
570

571
572
    // === course related functions ===

573
    'core_course_get_contents' => array(
574
        'classname'   => 'core_course_external',
575
        'methodname'  => 'get_course_contents',
576
        'classpath'   => 'course/externallib.php',
577
        'description' => 'Get course contents',
578
        'type'        => 'read',
579
        'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses',
580
    ),
581

582
    'moodle_course_get_courses' => array(
583
584
585
586
587
588
589
590
591
592
        'classname'   => 'core_course_external',
        'methodname'  => 'get_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_get_courses()',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
    ),

    'core_course_get_courses' => array(
        'classname'   => 'core_course_external',
593
594
595
596
597
598
599
600
        'methodname'  => 'get_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'Return course details',
        'type'        => 'read',
        'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses',
    ),

    'moodle_course_create_courses' => array(
601
602
603
604
605
606
607
608
609
610
        'classname'   => 'core_course_external',
        'methodname'  => 'create_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_course_create_courses()',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:create,moodle/course:visibility',
    ),

    'core_course_create_courses' => array(
        'classname'   => 'core_course_external',
611
612
613
614
615
616
617
        'methodname'  => 'create_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'Create new courses',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:create,moodle/course:visibility',
    ),

618
619
620
621
622
623
624
625
626
    'core_course_delete_courses' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'delete_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'Deletes all specified courses',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:delete',
    ),

627
628
629
630
631
632
633
634
635
    'core_course_delete_modules' => array(
        'classname' => 'core_course_external',
        'methodname' => 'delete_modules',
        'classpath' => 'course/externallib.php',
        'description' => 'Deletes all specified module instances',
        'type' => 'write',
        'capabilities' => 'moodle/course:manageactivities'
    ),

636
637
638
639
640
641
642
643
644
    'core_course_duplicate_course' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'duplicate_course',
        'classpath'   => 'course/externallib.php',
        'description' => 'Duplicate an existing course (creating a new one) without user data',
        'type'        => 'write',
        'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create',
    ),

645
646
647
648
649
650
651
652
653
    'core_course_update_courses' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'update_courses',
        'classpath'   => 'course/externallib.php',
        'description' => 'Update courses',
        'type'        => 'write',
        'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility',
    ),

654
655
656
657
658
659
660
661
662
663
664
    // === course category related functions ===

    'core_course_get_categories' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'get_categories',
        'classpath'   => 'course/externallib.php',
        'description' => 'Return category details',
        'type'        => 'read',
        'capabilities'=> 'moodle/category:viewhiddencategories',
    ),

665
666
667
668
669
670
671
672
    'core_course_create_categories' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'create_categories',
        'classpath'   => 'course/externallib.php',
        'description' => 'Create course categories',
        'type'        => 'write',
        'capabilities'=> 'moodle/category:manage',
    ),
673

674
675
676
677
678
679
    'core_course_update_categories' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'update_categories',
        'classpath'   => 'course/externallib.php',
        'description' => 'Update categories',
        'type'        => 'write',
680
        'capabilities'=> 'moodle/category:manage',
681
682
    ),

683
684
685
686
687
688
689
690
    'core_course_delete_categories' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'delete_categories',
        'classpath'   => 'course/externallib.php',
        'description' => 'Delete course categories',
        'type'        => 'write',
        'capabilities'=> 'moodle/category:manage',
    ),
691

692
693
694
695
696
697
698
699
700
    'core_course_import_course' => array(
        'classname'   => 'core_course_external',
        'methodname'  => 'import_course',
        'classpath'   => 'course/externallib.php',
        'description' => 'Import course data from a course into another course. Does not include any user data.',
        'type'        => 'write',
        'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport',
    ),

701
702
    // === message related functions ===

703
    'moodle_message_send_instantmessages' => array(
704
705
706
707
708
709
710
711
712
713
714
        'classname'   => 'core_message_external',
        'methodname'  => 'send_instant_messages',
        'classpath'   => 'message/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_message_send_instant_messages()',
        'type'        => 'write',
        'capabilities'=> 'moodle/site:sendmessage',
    ),

    'core_message_send_instant_messages' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'send_instant_messages',
715
        'classpath'   => 'message/externallib.php',
716
        'description' => 'Send instant messages',
717
718
719
720
        'type'        => 'write',
        'capabilities'=> 'moodle/site:sendmessage',
    ),

721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
    'core_message_create_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'create_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Add contacts to the contact list',
        'type'        => 'write',
        'capabilities'=> '',
    ),

    'core_message_delete_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'delete_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Remove contacts from the contact list',
        'type'        => 'write',
        'capabilities'=> '',
    ),

    'core_message_block_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'block_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Block contacts',
        'type'        => 'write',
        'capabilities'=> '',
    ),

    'core_message_unblock_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'unblock_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Unblock contacts',
        'type'        => 'write',
        'capabilities'=> '',
    ),

    'core_message_get_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'get_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Retrieve the contact list',
        'type'        => 'read',
        'capabilities'=> '',
    ),

    'core_message_search_contacts' => array(
        'classname'   => 'core_message_external',
        'methodname'  => 'search_contacts',
        'classpath'   => 'message/externallib.php',
        'description' => 'Search for contacts',
        'type'        => 'read',
        'capabilities'=> '',
    ),

775
    'core_message_get_messages' => array(
776
777
778
        'classname'     => 'core_message_external',
        'methodname'    => 'get_messages',
        'classpath'     => 'message/externallib.php',
779
        'description'   => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)',
780
781
        'type'          => 'read',
        'capabilities'  => '',
782
783
    ),

784
785
786
    // === notes related functions ===

    'moodle_notes_create_notes' => array(
787
788
789
790
791
792
793
794
795
796
        'classname'   => 'core_notes_external',
        'methodname'  => 'create_notes',
        'classpath'   => 'notes/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_notes_create_notes()',
        'type'        => 'write',
        'capabilities'=> 'moodle/notes:manage',
    ),

    'core_notes_create_notes' => array(
        'classname'   => 'core_notes_external',
797
798
799
800
801
802
803
        'methodname'  => 'create_notes',
        'classpath'   => 'notes/externallib.php',
        'description' => 'Create notes',
        'type'        => 'write',
        'capabilities'=> 'moodle/notes:manage',
    ),

804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
    'core_notes_delete_notes' => array(
        'classname'   => 'core_notes_external',
        'methodname'  => 'delete_notes',
        'classpath'   => 'notes/externallib.php',
        'description' => 'Delete notes',
        'type'        => 'write',
        'capabilities'=> 'moodle/notes:manage',
    ),

    'core_notes_get_notes' => array(
        'classname'   => 'core_notes_external',
        'methodname'  => 'get_notes',
        'classpath'   => 'notes/externallib.php',
        'description' => 'Get notes',
        'type'        => 'read',
        'capabilities'=> 'moodle/notes:view',
    ),

    'core_notes_update_notes' => array(
        'classname'   => 'core_notes_external',
        'methodname'  => 'update_notes',
        'classpath'   => 'notes/externallib.php',
        'description' => 'Update notes',
        'type'        => 'write',
        'capabilities'=> 'moodle/notes:manage',
    ),

831
832
833
834
835
836
837
838
    // === grading related functions ===

    'core_grading_get_definitions' => array(
        'classname'   => 'core_grading_external',
        'methodname'  => 'get_definitions',
        'description' => 'Get grading definitions',
        'type'        => 'read'
    ),
839
840
841
842
843

    'core_grade_get_definitions' => array(
        'classname'   => 'core_grade_external',
        'methodname'  => 'get_definitions',
        'classpath'   => 'grade/externallib.php',
844
845
846
847
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()',
        'type'        => 'read'
    ),

848
849
850
851
852
853
854
    'core_grading_save_definitions' => array(
        'classname'   => 'core_grading_external',
        'methodname'  => 'save_definitions',
        'description' => 'Save grading definitions',
        'type'        => 'write'
    ),

855
856
857
858
    'core_grading_get_gradingform_instances' => array(
        'classname'   => 'core_grading_external',
        'methodname'  => 'get_gradingform_instances',
        'description' => 'Get grading form instances',
859
860
861
        'type'        => 'read'
    ),

862
863
864
    // === webservice related functions ===

    'moodle_webservice_get_siteinfo' => array(
865
866
867
868
869
870
871
872
873
874
        'classname'   => 'core_webservice_external',
        'methodname'  => 'get_site_info',
        'classpath'   => 'webservice/externallib.php',
        'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has be renamed as core_webservice_get_site_info()',
        'type'        => 'read',
    ),

    'core_webservice_get_site_info' => array(
        'classname'   => 'core_webservice_external',
        'methodname'  => 'get_site_info',
875
876
877
878
879
        'classpath'   => 'webservice/externallib.php',
        'description' => 'Return some site info / user info / list web service functions',
        'type'        => 'read',
    ),

880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
    'core_get_string' => array(
        'classname'   => 'core_external',
        'methodname'  => 'get_string',
        'classpath'   => 'lib/external/externallib.php',
        'description' => 'Return a translated string - similar to core get_string() call',
        'type'        => 'read',
    ),

    'core_get_strings' => array(
        'classname'   => 'core_external',
        'methodname'  => 'get_strings',
        'classpath'   => 'lib/external/externallib.php',
        'description' => 'Return some translated strings - like several core get_string() calls',
        'type'        => 'read',
    ),

    'core_get_component_strings' => array(
        'classname'   => 'core_external',
        'methodname'  => 'get_component_strings',
        'classpath'   => 'lib/external/externallib.php',
        'description' => 'Return all raw strings (with {$a->xxx}) for a specific component
            - similar to core get_component_strings() call',
        'type'        => 'read',
    ),
904
905
906
907
908
909
910
911
912
913
914
915
916


    // === Calendar related functions ===

    'core_calendar_delete_calendar_events' => array(
        'classname'   => 'core_calendar_external',
        'methodname'  => 'delete_calendar_events',
        'description' => 'Delete calendar events',
        'classpath'   => 'calendar/externallib.php',
        'type'        => 'write',
        'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
    ),

917
918
919
920
921
922
923
924
925
926

    'core_calendar_get_calendar_events' => array(
        'classname'   => 'core_calendar_external',
        'methodname'  => 'get_calendar_events',
        'description' => 'Get calendar events',
        'classpath'   => 'calendar/externallib.php',
        'type'        => 'read',
        'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
    ),

927
928
929
930
931
932
933
934
    'core_calendar_create_calendar_events' => array(
        'classname'   => 'core_calendar_external',
        'methodname'  => 'create_calendar_events',
        'description' => 'Create calendar events',
        'classpath'   => 'calendar/externallib.php',
        'type'        => 'write',
        'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries'
    ),
935
);
936
937

$services = array(
938
939
940
941
   'Moodle mobile web service'  => array(
        'functions' => array (
            'moodle_enrol_get_users_courses',
            'moodle_enrol_get_enrolled_users',
942
943
944
            'moodle_user_get_users_by_id',
            'moodle_webservice_get_siteinfo',
            'moodle_notes_create_notes',
Dongsheng Cai's avatar
Dongsheng Cai committed
945
            'moodle_user_get_course_participants_by_id',
946
            'moodle_user_get_users_by_courseid',
947
            'moodle_message_send_instantmessages',
948
            'core_course_get_contents',
949
            'core_get_component_strings',
950
            'core_user_add_user_device',
951
952
953
954
955
956
957
958
            'core_calendar_get_calendar_events',
            'core_enrol_get_users_courses',
            'core_enrol_get_enrolled_users',
            'core_user_get_users_by_id',
            'core_webservice_get_site_info',
            'core_notes_create_notes',
            'core_user_get_course_user_profiles',
            'core_enrol_get_enrolled_users',
959
960
961
962
963
964
965
966
967
968
969
970
971
972
            'core_message_send_instant_messages',
            'mod_assign_get_grades',
            'mod_assign_get_assignments',
            'mod_assign_get_submissions',
            'mod_assign_get_user_flags',
            'mod_assign_set_user_flags',
            'mod_assign_get_user_mappings',
            'mod_assign_revert_submissions_to_draft',
            'mod_assign_lock_submissions',
            'mod_assign_unlock_submissions',
            'mod_assign_save_submission',
            'mod_assign_submit_for_grading',
            'mod_assign_save_grade',
            'mod_assign_save_user_extensions',
973
974
            'mod_assign_reveal_identities',
            'message_airnotifier_is_system_configured',
975
            'message_airnotifier_are_notification_preferences_configured',
976
977
            'core_grades_update_grades',
            'mod_forum_get_forums_by_courses',
978
            'mod_forum_get_forum_discussions_paginated',
979
            'mod_forum_get_forum_discussion_posts',
980
            'core_files_get_files',
981
982
983
984
985
986
987
            'core_message_get_messages',
            'core_message_create_contacts',
            'core_message_delete_contacts',
            'core_message_block_contacts',
            'core_message_unblock_contacts',
            'core_message_get_contacts',
            'core_message_search_contacts'),
988
989
        'enabled' => 0,
        'restrictedusers' => 0,
990
        'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE,
991
992
        'downloadfiles' => 1,
        'uploadfiles' => 1
993
994
    ),
);