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 * 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 * 30 * @package core_webservice 31 * @category webservice 32 * @copyright 2009 Petr Skodak 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 36$functions = array( 37 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 103 // Comments related functions. 104 105 'core_comment_get_comments' => array( 106 'classname' => 'core_comment_external', 107 'methodname' => 'get_comments', 108 'description' => 'Returns comments.', 109 'type' => 'read', 110 'capabilities' => 'moodle/comment:view', 111 ), 112 113 // Grade related functions. 114 115 'core_grades_get_grades' => array( 116 'classname' => 'core_grades_external', 117 'methodname' => 'get_grades', 118 'description' => 'Returns student course total grade and grades for activities. 119 This function does not return category or manual items. 120 This function is suitable for managers or teachers not students.', 121 'type' => 'read', 122 'capabilities' => 'moodle/grade:view, moodle/grade:viewall, moodle/grade:viewhidden', 123 ), 124 125 'core_grades_update_grades' => array( 126 'classname' => 'core_grades_external', 127 'methodname' => 'update_grades', 128 'description' => 'Update a grade item and associated student grades.', 129 'type' => 'write', 130 'capabilities' => '', 131 ), 132 133 // === group related functions === 134 135 'moodle_group_create_groups' => array( 136 'classname' => 'moodle_group_external', 137 'methodname' => 'create_groups', 138 'classpath' => 'group/externallib.php', 139 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_create_groups(). ', 140 'type' => 'write', 141 'capabilities'=> 'moodle/course:managegroups', 142 ), 143 144 'core_group_create_groups' => array( 145 'classname' => 'core_group_external', 146 'methodname' => 'create_groups', 147 'classpath' => 'group/externallib.php', 148 'description' => 'Creates new groups.', 149 'type' => 'write', 150 'capabilities'=> 'moodle/course:managegroups', 151 ), 152 153 'moodle_group_get_groups' => array( 154 'classname' => 'moodle_group_external', 155 'methodname' => 'get_groups', 156 'classpath' => 'group/externallib.php', 157 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_groups()', 158 'type' => 'read', 159 'capabilities'=> 'moodle/course:managegroups', 160 ), 161 162 'core_group_get_groups' => array( 163 'classname' => 'core_group_external', 164 'methodname' => 'get_groups', 165 'classpath' => 'group/externallib.php', 166 'description' => 'Returns group details.', 167 'type' => 'read', 168 'capabilities'=> 'moodle/course:managegroups', 169 ), 170 171 'moodle_group_get_course_groups' => array( 172 'classname' => 'moodle_group_external', 173 'methodname' => 'get_course_groups', 174 'classpath' => 'group/externallib.php', 175 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_course_groups()', 176 'type' => 'read', 177 'capabilities'=> 'moodle/course:managegroups', 178 ), 179 180 'core_group_get_course_groups' => array( 181 'classname' => 'core_group_external', 182 'methodname' => 'get_course_groups', 183 'classpath' => 'group/externallib.php', 184 'description' => 'Returns all groups in specified course.', 185 'type' => 'read', 186 'capabilities'=> 'moodle/course:managegroups', 187 ), 188 189 'moodle_group_delete_groups' => array( 190 'classname' => 'moodle_group_external', 191 'methodname' => 'delete_groups', 192 'classpath' => 'group/externallib.php', 193 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_groups()', 194 'type' => 'delete', 195 'capabilities'=> 'moodle/course:managegroups', 196 ), 197 198 'core_group_delete_groups' => array( 199 'classname' => 'core_group_external', 200 'methodname' => 'delete_groups', 201 'classpath' => 'group/externallib.php', 202 'description' => 'Deletes all specified groups.', 203 'type' => 'delete', 204 'capabilities'=> 'moodle/course:managegroups', 205 ), 206 207 'moodle_group_get_groupmembers' => array( 208 'classname' => 'moodle_group_external', 209 'methodname' => 'get_groupmembers', 210 'classpath' => 'group/externallib.php', 211 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_get_group_members()', 212 'type' => 'read', 213 'capabilities'=> 'moodle/course:managegroups', 214 ), 215 216 'core_group_get_group_members' => array( 217 'classname' => 'core_group_external', 218 'methodname' => 'get_group_members', 219 'classpath' => 'group/externallib.php', 220 'description' => 'Returns group members.', 221 'type' => 'read', 222 'capabilities'=> 'moodle/course:managegroups', 223 ), 224 225 'moodle_group_add_groupmembers' => array( 226 'classname' => 'moodle_group_external', 227 'methodname' => 'add_groupmembers', 228 'classpath' => 'group/externallib.php', 229 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_add_group_members()', 230 'type' => 'write', 231 'capabilities'=> 'moodle/course:managegroups', 232 ), 233 234 'core_group_add_group_members' => array( 235 'classname' => 'core_group_external', 236 'methodname' => 'add_group_members', 237 'classpath' => 'group/externallib.php', 238 'description' => 'Adds group members.', 239 'type' => 'write', 240 'capabilities'=> 'moodle/course:managegroups', 241 ), 242 243 'moodle_group_delete_groupmembers' => array( 244 'classname' => 'moodle_group_external', 245 'methodname' => 'delete_groupmembers', 246 'classpath' => 'group/externallib.php', 247 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_group_delete_group_members()', 248 'type' => 'delete', 249 'capabilities'=> 'moodle/course:managegroups', 250 ), 251 252 'core_group_delete_group_members' => array( 253 'classname' => 'core_group_external', 254 'methodname' => 'delete_group_members', 255 'classpath' => 'group/externallib.php', 256 'description' => 'Deletes group members.', 257 'type' => 'delete', 258 'capabilities'=> 'moodle/course:managegroups', 259 ), 260 261 'core_group_create_groupings' => array( 262 'classname' => 'core_group_external', 263 'methodname' => 'create_groupings', 264 'classpath' => 'group/externallib.php', 265 'description' => 'Creates new groupings', 266 'type' => 'write', 267 ), 268 269 'core_group_update_groupings' => array( 270 'classname' => 'core_group_external', 271 'methodname' => 'update_groupings', 272 'classpath' => 'group/externallib.php', 273 'description' => 'Updates existing groupings', 274 'type' => 'write', 275 ), 276 277 'core_group_get_groupings' => array( 278 'classname' => 'core_group_external', 279 'methodname' => 'get_groupings', 280 'classpath' => 'group/externallib.php', 281 'description' => 'Returns groupings details.', 282 'type' => 'read', 283 ), 284 285 'core_group_get_course_groupings' => array( 286 'classname' => 'core_group_external', 287 'methodname' => 'get_course_groupings', 288 'classpath' => 'group/externallib.php', 289 'description' => 'Returns all groupings in specified course.', 290 'type' => 'read', 291 ), 292 293 'core_group_delete_groupings' => array( 294 'classname' => 'core_group_external', 295 'methodname' => 'delete_groupings', 296 'classpath' => 'group/externallib.php', 297 'description' => 'Deletes all specified groupings.', 298 'type' => 'write', 299 ), 300 301 'core_group_assign_grouping' => array( 302 'classname' => 'core_group_external', 303 'methodname' => 'assign_grouping', 304 'classpath' => 'group/externallib.php', 305 'description' => 'Assing groups from groupings', 306 'type' => 'write', 307 ), 308 309 'core_group_unassign_grouping' => array( 310 'classname' => 'core_group_external', 311 'methodname' => 'unassign_grouping', 312 'classpath' => 'group/externallib.php', 313 'description' => 'Unassing groups from groupings', 314 'type' => 'write', 315 ), 316 317 'core_group_get_course_user_groups' => array( 318 'classname' => 'core_group_external', 319 'methodname' => 'get_course_user_groups', 320 'classpath' => 'group/externallib.php', 321 'description' => 'Returns all groups in specified course for the specified user.', 322 'type' => 'read', 323 'capabilities' => 'moodle/course:managegroups', 324 ), 325 326 'core_group_get_activity_allowed_groups' => array( 327 'classname' => 'core_group_external', 328 'methodname' => 'get_activity_allowed_groups', 329 'classpath' => 'group/externallib.php', 330 'description' => 'Gets a list of groups that the user is allowed to access within the specified activity.', 331 'type' => 'read', 332 'capabilities' => '', 333 ), 334 335 'core_group_get_activity_groupmode' => array( 336 'classname' => 'core_group_external', 337 'methodname' => 'get_activity_groupmode', 338 'classpath' => 'group/externallib.php', 339 'description' => 'Returns effective groupmode used in a given activity.', 340 'type' => 'read', 341 'capabilities' => '', 342 ), 343 344 'core_notes_get_course_notes' => array( 345 'classname' => 'core_notes_external', 346 'methodname' => 'get_course_notes', 347 'classpath' => 'notes/externallib.php', 348 'description' => 'Returns all notes in specified course (or site) for the specified user.', 349 'type' => 'read', 350 'capabilities' => 'moodle/notes:view', 351 ), 352 353 // === file related functions === 354 355 'moodle_file_get_files' => array( 356 'classname' => 'moodle_file_external', 357 'methodname' => 'get_files', 358 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_get_files()', 359 'type' => 'read', 360 'classpath' => 'files/externallib.php', 361 ), 362 363 'core_files_get_files' => array( 364 'classname' => 'core_files_external', 365 'methodname' => 'get_files', 366 'description' => 'browse moodle files', 367 'type' => 'read', 368 'classpath' => 'files/externallib.php', 369 ), 370 371 'moodle_file_upload' => array( 372 'classname' => 'moodle_file_external', 373 'methodname' => 'upload', 374 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_files_upload()', 375 'type' => 'write', 376 'classpath' => 'files/externallib.php', 377 ), 378 379 'core_files_upload' => array( 380 'classname' => 'core_files_external', 381 'methodname' => 'upload', 382 'description' => 'upload a file to moodle', 383 'type' => 'write', 384 'classpath' => 'files/externallib.php', 385 ), 386 387 // === user related functions === 388 389 'moodle_user_create_users' => array( 390 'classname' => 'moodle_user_external', 391 'methodname' => 'create_users', 392 'classpath' => 'user/externallib.php', 393 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_create_users()', 394 'type' => 'write', 395 'capabilities'=> 'moodle/user:create', 396 ), 397 398 'core_user_create_users' => array( 399 'classname' => 'core_user_external', 400 'methodname' => 'create_users', 401 'classpath' => 'user/externallib.php', 402 'description' => 'Create users.', 403 'type' => 'write', 404 'capabilities'=> 'moodle/user:create', 405 ), 406 407 'core_user_get_users' => array( 408 'classname' => 'core_user_external', 409 'methodname' => 'get_users', 410 'classpath' => 'user/externallib.php', 411 'description' => 'search for users matching the parameters', 412 'type' => 'read', 413 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update', 414 ), 415 416 'moodle_user_get_users_by_id' => array( 417 'classname' => 'moodle_user_external', 418 'methodname' => 'get_users_by_id', 419 'classpath' => 'user/externallib.php', 420 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. Use core_user_get_users_by_field service instead', 421 'type' => 'read', 422 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update', 423 ), 424 425 'core_user_get_users_by_field' => array( 426 'classname' => 'core_user_external', 427 'methodname' => 'get_users_by_field', 428 'classpath' => 'user/externallib.php', 429 'description' => 'Retrieve users information for a specified unique field - If you want to do a user search, use core_user_get_users()', 430 'type' => 'read', 431 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update', 432 ), 433 434 'core_user_get_users_by_id' => array( 435 'classname' => 'core_user_external', 436 'methodname' => 'get_users_by_id', 437 'classpath' => 'user/externallib.php', 438 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been replaced by core_user_get_users_by_field()', 439 'type' => 'read', 440 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update', 441 ), 442 443 'moodle_user_get_users_by_courseid' => array( 444 'classname' => 'moodle_user_external', 445 'methodname' => 'get_users_by_courseid', 446 'classpath' => 'user/externallib.php', 447 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_enrolled_users()', 448 'type' => 'read', 449 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', 450 ), 451 452 'moodle_user_get_course_participants_by_id' => array( 453 'classname' => 'moodle_user_external', 454 'methodname' => 'get_course_participants_by_id', 455 'classpath' => 'user/externallib.php', 456 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_get_course_user_profiles()', 457 'type' => 'read', 458 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', 459 ), 460 461 'core_user_get_course_user_profiles' => array( 462 'classname' => 'core_user_external', 463 'methodname' => 'get_course_user_profiles', 464 'classpath' => 'user/externallib.php', 465 'description' => 'Get course user profiles (each of the profils matching a course id and a user id).', 466 'type' => 'read', 467 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', 468 ), 469 470 'moodle_user_delete_users' => array( 471 'classname' => 'moodle_user_external', 472 'methodname' => 'delete_users', 473 'classpath' => 'user/externallib.php', 474 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_delete_users()', 475 'type' => 'write', 476 'capabilities'=> 'moodle/user:delete', 477 ), 478 479 'core_user_delete_users' => array( 480 'classname' => 'core_user_external', 481 'methodname' => 'delete_users', 482 'classpath' => 'user/externallib.php', 483 'description' => 'Delete users.', 484 'type' => 'write', 485 'capabilities'=> 'moodle/user:delete', 486 ), 487 488 'moodle_user_update_users' => array( 489 'classname' => 'moodle_user_external', 490 'methodname' => 'update_users', 491 'classpath' => 'user/externallib.php', 492 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_user_update_users()', 493 'type' => 'write', 494 'capabilities'=> 'moodle/user:update', 495 ), 496 497 'core_user_update_users' => array( 498 'classname' => 'core_user_external', 499 'methodname' => 'update_users', 500 'classpath' => 'user/externallib.php', 501 'description' => 'Update users.', 502 'type' => 'write', 503 'capabilities'=> 'moodle/user:update', 504 ), 505 506 'core_user_add_user_device' => array( 507 'classname' => 'core_user_external', 508 'methodname' => 'add_user_device', 509 'classpath' => 'user/externallib.php', 510 'description' => 'Store mobile user devices information for PUSH Notifications.', 511 'type' => 'write', 512 'capabilities'=> '', 513 ), 514 515 'core_user_remove_user_device' => array( 516 'classname' => 'core_user_external', 517 'methodname' => 'remove_user_device', 518 'classpath' => 'user/externallib.php', 519 'description' => 'Remove a user device from the Moodle database.', 520 'type' => 'write', 521 'capabilities' => '', 522 ), 523 524 'core_user_view_user_list' => array( 525 'classname' => 'core_user_external', 526 'methodname' => 'view_user_list', 527 'classpath' => 'user/externallib.php', 528 'description' => 'Simulates the web-interface view of user/index.php (triggering events).', 529 'type' => 'write', 530 'capabilities' => 'moodle/course:viewparticipants', 531 ), 532 533 'core_user_view_user_profile' => array( 534 'classname' => 'core_user_external', 535 'methodname' => 'view_user_profile', 536 'classpath' => 'user/externallib.php', 537 'description' => 'Simulates the web-interface view of user/view.php and user/profile.php (triggering events).', 538 'type' => 'write', 539 'capabilities' => 'moodle/user:viewdetails', 540 ), 541 542 'core_user_add_user_private_files' => array( 543 'classname' => 'core_user_external', 544 'methodname' => 'add_user_private_files', 545 'classpath' => 'user/externallib.php', 546 'description' => 'Copy files from a draft area to users private files area.', 547 'type' => 'write', 548 'capabilities' => 'moodle/user:manageownfiles', 549 ), 550 551 // === enrol related functions === 552 553 'core_enrol_get_enrolled_users_with_capability' => array( 554 'classname' => 'core_enrol_external', 555 'methodname' => 'get_enrolled_users_with_capability', 556 'classpath' => 'enrol/externallib.php', 557 'description' => 'For each course and capability specified, return a list of the users that are enrolled in the course 558 and have that capability', 559 'type' => 'read', 560 ), 561 562 'moodle_enrol_get_enrolled_users' => array( 563 'classname' => 'moodle_enrol_external', 564 'methodname' => 'get_enrolled_users', 565 'classpath' => 'enrol/externallib.php', 566 '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).', 567 'type' => 'read', 568 'capabilities'=> 'moodle/site:viewparticipants, moodle/course:viewparticipants, 569 moodle/role:review, moodle/site:accessallgroups, moodle/course:enrolreview', 570 ), 571 572 'core_enrol_get_enrolled_users' => array( 573 'classname' => 'core_enrol_external', 574 'methodname' => 'get_enrolled_users', 575 'classpath' => 'enrol/externallib.php', 576 'description' => 'Get enrolled users by course id.', 577 'type' => 'read', 578 'capabilities'=> 'moodle/user:viewdetails, moodle/user:viewhiddendetails, moodle/course:useremail, moodle/user:update, moodle/site:accessallgroups', 579 ), 580 581 'moodle_enrol_get_users_courses' => array( 582 'classname' => 'moodle_enrol_external', 583 'methodname' => 'get_users_courses', 584 'classpath' => 'enrol/externallib.php', 585 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_enrol_get_users_courses()', 586 'type' => 'read', 587 'capabilities'=> 'moodle/course:viewparticipants', 588 ), 589 590 'core_enrol_get_users_courses' => array( 591 'classname' => 'core_enrol_external', 592 'methodname' => 'get_users_courses', 593 'classpath' => 'enrol/externallib.php', 594 'description' => 'Get the list of courses where a user is enrolled in', 595 'type' => 'read', 596 'capabilities'=> 'moodle/course:viewparticipants', 597 ), 598 599 'core_enrol_get_course_enrolment_methods' => array( 600 'classname' => 'core_enrol_external', 601 'methodname' => 'get_course_enrolment_methods', 602 'classpath' => 'enrol/externallib.php', 603 'description' => 'Get the list of course enrolment methods', 604 'type' => 'read', 605 ), 606 607 // === Role related functions === 608 609 'moodle_role_assign' => array( 610 'classname' => 'moodle_enrol_external', 611 'methodname' => 'role_assign', 612 'classpath' => 'enrol/externallib.php', 613 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_assign_role()', 614 'type' => 'write', 615 'capabilities'=> 'moodle/role:assign', 616 ), 617 618 'core_role_assign_roles' => array( 619 'classname' => 'core_role_external', 620 'methodname' => 'assign_roles', 621 'classpath' => 'enrol/externallib.php', 622 'description' => 'Manual role assignments.', 623 'type' => 'write', 624 'capabilities'=> 'moodle/role:assign', 625 ), 626 627 'moodle_role_unassign' => array( 628 'classname' => 'moodle_enrol_external', 629 'methodname' => 'role_unassign', 630 'classpath' => 'enrol/externallib.php', 631 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_role_unassign_role()', 632 'type' => 'write', 633 'capabilities'=> 'moodle/role:assign', 634 ), 635 636 'core_role_unassign_roles' => array( 637 'classname' => 'core_role_external', 638 'methodname' => 'unassign_roles', 639 'classpath' => 'enrol/externallib.php', 640 'description' => 'Manual role unassignments.', 641 'type' => 'write', 642 'capabilities'=> 'moodle/role:assign', 643 ), 644 645 // === course related functions === 646 647 'core_course_get_contents' => array( 648 'classname' => 'core_course_external', 649 'methodname' => 'get_course_contents', 650 'classpath' => 'course/externallib.php', 651 'description' => 'Get course contents', 652 'type' => 'read', 653 'capabilities'=> 'moodle/course:update,moodle/course:viewhiddencourses', 654 ), 655 656 'moodle_course_get_courses' => array( 657 'classname' => 'moodle_course_external', 658 'methodname' => 'get_courses', 659 'classpath' => 'course/externallib.php', 660 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_get_courses()', 661 'type' => 'read', 662 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses', 663 ), 664 665 'core_course_get_courses' => array( 666 'classname' => 'core_course_external', 667 'methodname' => 'get_courses', 668 'classpath' => 'course/externallib.php', 669 'description' => 'Return course details', 670 'type' => 'read', 671 'capabilities'=> 'moodle/course:view,moodle/course:update,moodle/course:viewhiddencourses', 672 ), 673 674 'core_course_search_courses' => array( 675 'classname' => 'core_course_external', 676 'methodname' => 'search_courses', 677 'classpath' => 'course/externallib.php', 678 'description' => 'Search courses by (name, module, block, tag)', 679 'type' => 'read', 680 'capabilities' => '', 681 ), 682 683 'moodle_course_create_courses' => array( 684 'classname' => 'moodle_course_external', 685 'methodname' => 'create_courses', 686 'classpath' => 'course/externallib.php', 687 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_course_create_courses()', 688 'type' => 'write', 689 'capabilities'=> 'moodle/course:create,moodle/course:visibility', 690 ), 691 692 'core_course_create_courses' => array( 693 'classname' => 'core_course_external', 694 'methodname' => 'create_courses', 695 'classpath' => 'course/externallib.php', 696 'description' => 'Create new courses', 697 'type' => 'write', 698 'capabilities'=> 'moodle/course:create,moodle/course:visibility', 699 ), 700 701 'core_course_delete_courses' => array( 702 'classname' => 'core_course_external', 703 'methodname' => 'delete_courses', 704 'classpath' => 'course/externallib.php', 705 'description' => 'Deletes all specified courses', 706 'type' => 'write', 707 'capabilities'=> 'moodle/course:delete', 708 ), 709 710 'core_course_delete_modules' => array( 711 'classname' => 'core_course_external', 712 'methodname' => 'delete_modules', 713 'classpath' => 'course/externallib.php', 714 'description' => 'Deletes all specified module instances', 715 'type' => 'write', 716 'capabilities' => 'moodle/course:manageactivities' 717 ), 718 719 'core_course_duplicate_course' => array( 720 'classname' => 'core_course_external', 721 'methodname' => 'duplicate_course', 722 'classpath' => 'course/externallib.php', 723 'description' => 'Duplicate an existing course (creating a new one) without user data', 724 'type' => 'write', 725 'capabilities'=> 'moodle/backup:backupcourse,moodle/restore:restorecourse,moodle/course:create', 726 ), 727 728 'core_course_update_courses' => array( 729 'classname' => 'core_course_external', 730 'methodname' => 'update_courses', 731 'classpath' => 'course/externallib.php', 732 'description' => 'Update courses', 733 'type' => 'write', 734 'capabilities'=> 'moodle/course:update,moodle/course:changecategory,moodle/course:changefullname,moodle/course:changeshortname,moodle/course:changeidnumber,moodle/course:changesummary,moodle/course:visibility', 735 ), 736 737 'core_course_view_course' => array( 738 'classname' => 'core_course_external', 739 'methodname' => 'view_course', 740 'classpath' => 'course/externallib.php', 741 'description' => 'Log that the course was viewed', 742 'type' => 'write' 743 ), 744 745 'core_course_get_course_module' => array( 746 'classname' => 'core_course_external', 747 'methodname' => 'get_course_module', 748 'classpath' => 'course/externallib.php', 749 'description' => 'Return information about a course module', 750 'type' => 'read' 751 ), 752 753 'core_course_get_course_module_by_instance' => array( 754 'classname' => 'core_course_external', 755 'methodname' => 'get_course_module_by_instance', 756 'classpath' => 'course/externallib.php', 757 'description' => 'Return information about a given module name and instance id', 758 'type' => 'read' 759 ), 760 761 // === course category related functions === 762 763 'core_course_get_categories' => array( 764 'classname' => 'core_course_external', 765 'methodname' => 'get_categories', 766 'classpath' => 'course/externallib.php', 767 'description' => 'Return category details', 768 'type' => 'read', 769 'capabilities'=> 'moodle/category:viewhiddencategories', 770 ), 771 772 'core_course_create_categories' => array( 773 'classname' => 'core_course_external', 774 'methodname' => 'create_categories', 775 'classpath' => 'course/externallib.php', 776 'description' => 'Create course categories', 777 'type' => 'write', 778 'capabilities'=> 'moodle/category:manage', 779 ), 780 781 'core_course_update_categories' => array( 782 'classname' => 'core_course_external', 783 'methodname' => 'update_categories', 784 'classpath' => 'course/externallib.php', 785 'description' => 'Update categories', 786 'type' => 'write', 787 'capabilities'=> 'moodle/category:manage', 788 ), 789 790 'core_course_delete_categories' => array( 791 'classname' => 'core_course_external', 792 'methodname' => 'delete_categories', 793 'classpath' => 'course/externallib.php', 794 'description' => 'Delete course categories', 795 'type' => 'write', 796 'capabilities'=> 'moodle/category:manage', 797 ), 798 799 'core_course_import_course' => array( 800 'classname' => 'core_course_external', 801 'methodname' => 'import_course', 802 'classpath' => 'course/externallib.php', 803 'description' => 'Import course data from a course into another course. Does not include any user data.', 804 'type' => 'write', 805 'capabilities'=> 'moodle/backup:backuptargetimport, moodle/restore:restoretargetimport', 806 ), 807 808 // === message related functions === 809 810 'moodle_message_send_instantmessages' => array( 811 'classname' => 'moodle_message_external', 812 'methodname' => 'send_instantmessages', 813 'classpath' => 'message/externallib.php', 814 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_message_send_instant_messages()', 815 'type' => 'write', 816 'capabilities'=> 'moodle/site:sendmessage', 817 ), 818 819 'core_message_send_instant_messages' => array( 820 'classname' => 'core_message_external', 821 'methodname' => 'send_instant_messages', 822 'classpath' => 'message/externallib.php', 823 'description' => 'Send instant messages', 824 'type' => 'write', 825 'capabilities'=> 'moodle/site:sendmessage', 826 ), 827 828 'core_message_create_contacts' => array( 829 'classname' => 'core_message_external', 830 'methodname' => 'create_contacts', 831 'classpath' => 'message/externallib.php', 832 'description' => 'Add contacts to the contact list', 833 'type' => 'write', 834 'capabilities'=> '', 835 ), 836 837 'core_message_delete_contacts' => array( 838 'classname' => 'core_message_external', 839 'methodname' => 'delete_contacts', 840 'classpath' => 'message/externallib.php', 841 'description' => 'Remove contacts from the contact list', 842 'type' => 'write', 843 'capabilities'=> '', 844 ), 845 846 'core_message_block_contacts' => array( 847 'classname' => 'core_message_external', 848 'methodname' => 'block_contacts', 849 'classpath' => 'message/externallib.php', 850 'description' => 'Block contacts', 851 'type' => 'write', 852 'capabilities'=> '', 853 ), 854 855 'core_message_unblock_contacts' => array( 856 'classname' => 'core_message_external', 857 'methodname' => 'unblock_contacts', 858 'classpath' => 'message/externallib.php', 859 'description' => 'Unblock contacts', 860 'type' => 'write', 861 'capabilities'=> '', 862 ), 863 864 'core_message_get_contacts' => array( 865 'classname' => 'core_message_external', 866 'methodname' => 'get_contacts', 867 'classpath' => 'message/externallib.php', 868 'description' => 'Retrieve the contact list', 869 'type' => 'read', 870 'capabilities'=> '', 871 ), 872 873 'core_message_search_contacts' => array( 874 'classname' => 'core_message_external', 875 'methodname' => 'search_contacts', 876 'classpath' => 'message/externallib.php', 877 'description' => 'Search for contacts', 878 'type' => 'read', 879 'capabilities'=> '', 880 ), 881 882 'core_message_get_messages' => array( 883 'classname' => 'core_message_external', 884 'methodname' => 'get_messages', 885 'classpath' => 'message/externallib.php', 886 'description' => 'Retrieve a list of messages sent and received by a user (conversations, notifications or both)', 887 'type' => 'read', 888 'capabilities' => '', 889 ), 890 891 'core_message_get_blocked_users' => array( 892 'classname' => 'core_message_external', 893 'methodname' => 'get_blocked_users', 894 'classpath' => 'message/externallib.php', 895 'description' => 'Retrieve a list of users blocked', 896 'type' => 'read', 897 'capabilities' => '', 898 ), 899 900 'core_message_mark_message_read' => array( 901 'classname' => 'core_message_external', 902 'methodname' => 'mark_message_read', 903 'classpath' => 'message/externallib.php', 904 'description' => 'Mark a single message as read, trigger message_viewed event.', 905 'type' => 'write', 906 'capabilities' => '', 907 ), 908 909 'core_message_delete_message' => array( 910 'classname' => 'core_message_external', 911 'methodname' => 'delete_message', 912 'classpath' => 'message/externallib.php', 913 'description' => 'Deletes a message.', 914 'type' => 'write', 915 'capabilities' => 'moodle/site:deleteownmessage', 916 ), 917 918 // === notes related functions === 919 920 'moodle_notes_create_notes' => array( 921 'classname' => 'moodle_notes_external', 922 'methodname' => 'create_notes', 923 'classpath' => 'notes/externallib.php', 924 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_notes_create_notes()', 925 'type' => 'write', 926 'capabilities'=> 'moodle/notes:manage', 927 ), 928 929 'core_notes_create_notes' => array( 930 'classname' => 'core_notes_external', 931 'methodname' => 'create_notes', 932 'classpath' => 'notes/externallib.php', 933 'description' => 'Create notes', 934 'type' => 'write', 935 'capabilities'=> 'moodle/notes:manage', 936 ), 937 938 'core_notes_delete_notes' => array( 939 'classname' => 'core_notes_external', 940 'methodname' => 'delete_notes', 941 'classpath' => 'notes/externallib.php', 942 'description' => 'Delete notes', 943 'type' => 'write', 944 'capabilities'=> 'moodle/notes:manage', 945 ), 946 947 'core_notes_get_notes' => array( 948 'classname' => 'core_notes_external', 949 'methodname' => 'get_notes', 950 'classpath' => 'notes/externallib.php', 951 'description' => 'Get notes', 952 'type' => 'read', 953 'capabilities'=> 'moodle/notes:view', 954 ), 955 956 'core_notes_update_notes' => array( 957 'classname' => 'core_notes_external', 958 'methodname' => 'update_notes', 959 'classpath' => 'notes/externallib.php', 960 'description' => 'Update notes', 961 'type' => 'write', 962 'capabilities'=> 'moodle/notes:manage', 963 ), 964 965 'core_notes_view_notes' => array( 966 'classname' => 'core_notes_external', 967 'methodname' => 'view_notes', 968 'classpath' => 'notes/externallib.php', 969 'description' => 'Simulates the web interface view of notes/index.php: trigger events.', 970 'type' => 'write', 971 'capabilities' => 'moodle/notes:view', 972 ), 973 974 // === grading related functions === 975 976 'core_grading_get_definitions' => array( 977 'classname' => 'core_grading_external', 978 'methodname' => 'get_definitions', 979 'description' => 'Get grading definitions', 980 'type' => 'read' 981 ), 982 983 'core_grade_get_definitions' => array( 984 'classname' => 'core_grade_external', 985 'methodname' => 'get_definitions', 986 'classpath' => 'grade/externallib.php', 987 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_grading_get_definitions()', 988 'type' => 'read' 989 ), 990 991 'core_grading_save_definitions' => array( 992 'classname' => 'core_grading_external', 993 'methodname' => 'save_definitions', 994 'description' => 'Save grading definitions', 995 'type' => 'write' 996 ), 997 998 'core_grading_get_gradingform_instances' => array( 999 'classname' => 'core_grading_external', 1000 'methodname' => 'get_gradingform_instances', 1001 'description' => 'Get grading form instances', 1002 'type' => 'read' 1003 ), 1004 1005 // === webservice related functions === 1006 1007 'moodle_webservice_get_siteinfo' => array( 1008 'classname' => 'moodle_webservice_external', 1009 'methodname' => 'get_siteinfo', 1010 'classpath' => 'webservice/externallib.php', 1011 'description' => 'DEPRECATED: this deprecated function will be removed in a future version. This function has been renamed as core_webservice_get_site_info()', 1012 'type' => 'read', 1013 ), 1014 1015 'core_webservice_get_site_info' => array( 1016 'classname' => 'core_webservice_external', 1017 'methodname' => 'get_site_info', 1018 'classpath' => 'webservice/externallib.php', 1019 'description' => 'Return some site info / user info / list web service functions', 1020 'type' => 'read', 1021 ), 1022 1023 'core_get_string' => array( 1024 'classname' => 'core_external', 1025 'methodname' => 'get_string', 1026 'classpath' => 'lib/external/externallib.php', 1027 'description' => 'Return a translated string - similar to core get_string() call', 1028 'type' => 'read', 1029 'loginrequired' => false, 1030 'ajax' => true, 1031 ), 1032 1033 'core_get_strings' => array( 1034 'classname' => 'core_external', 1035 'methodname' => 'get_strings', 1036 'classpath' => 'lib/external/externallib.php', 1037 'description' => 'Return some translated strings - like several core get_string() calls', 1038 'type' => 'read', 1039 'loginrequired' => false, 1040 'ajax' => true, 1041 ), 1042 1043 'core_get_component_strings' => array( 1044 'classname' => 'core_external', 1045 'methodname' => 'get_component_strings', 1046 'classpath' => 'lib/external/externallib.php', 1047 'description' => 'Return all raw strings (with {$a->xxx}) for a specific component 1048 - similar to core get_component_strings() call', 1049 'type' => 'read', 1050 'loginrequired' => false, 1051 'ajax' => true, 1052 ), 1053 1054 1055 // === Calendar related functions === 1056 1057 'core_calendar_delete_calendar_events' => array( 1058 'classname' => 'core_calendar_external', 1059 'methodname' => 'delete_calendar_events', 1060 'description' => 'Delete calendar events', 1061 'classpath' => 'calendar/externallib.php', 1062 'type' => 'write', 1063 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries' 1064 ), 1065 1066 1067 'core_calendar_get_calendar_events' => array( 1068 'classname' => 'core_calendar_external', 1069 'methodname' => 'get_calendar_events', 1070 'description' => 'Get calendar events', 1071 'classpath' => 'calendar/externallib.php', 1072 'type' => 'read', 1073 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries' 1074 ), 1075 1076 'core_calendar_create_calendar_events' => array( 1077 'classname' => 'core_calendar_external', 1078 'methodname' => 'create_calendar_events', 1079 'description' => 'Create calendar events', 1080 'classpath' => 'calendar/externallib.php', 1081 'type' => 'write', 1082 'capabilities'=> 'moodle/calendar:manageentries', 'moodle/calendar:manageownentries', 'moodle/calendar:managegroupentries' 1083 ), 1084 1085 'core_output_load_template' => array( 1086 'classname' => 'core\output\external', 1087 'methodname' => 'load_template', 1088 'description' => 'Load a template for a renderable', 1089 'type' => 'read', 1090 'loginrequired' => false, 1091 'ajax' => true, 1092 ), 1093 1094 // Completion related functions. 1095 'core_completion_update_activity_completion_status_manually' => array( 1096 'classname' => 'core_completion_external', 1097 'methodname' => 'update_activity_completion_status_manually', 1098 'description' => 'Update completion status for the current user in an activity, only for activities with manual tracking.', 1099 'type' => 'write', 1100 ), 1101 1102 'core_completion_mark_course_self_completed' => array( 1103 'classname' => 'core_completion_external', 1104 'methodname' => 'mark_course_self_completed', 1105 'description' => 'Update the course completion status for the current user (if course self-completion is enabled).', 1106 'type' => 'write', 1107 ), 1108 1109 'core_completion_get_activities_completion_status' => array( 1110 'classname' => 'core_completion_external', 1111 'methodname' => 'get_activities_completion_status', 1112 'description' => 'Return the activities completion status for a user in a course.', 1113 'type' => 'read', 1114 'capabilities' => '', 1115 ), 1116 1117 'core_completion_get_course_completion_status' => array( 1118 'classname' => 'core_completion_external', 1119 'methodname' => 'get_course_completion_status', 1120 'description' => 'Returns course completion status.', 1121 'type' => 'read', 1122 'capabilities' => 'report/completion:view', 1123 ), 1124 1125 // Rating functions. 1126 'core_rating_get_item_ratings' => array( 1127 'classname' => 'core_rating_external', 1128 'methodname' => 'get_item_ratings', 1129 'description' => 'Retrieve all the ratings for an item.', 1130 'type' => 'read', 1131 'capabilities' => 'moodle/rating:view' 1132 ), 1133 1134 // Tag functions. 1135 'core_tag_update_tags' => array( 1136 'classname' => 'core_tag_external', 1137 'methodname' => 'update_tags', 1138 'description' => 'Updates tags', 1139 'type' => 'write', 1140 'ajax' => true 1141 ), 1142 1143 'core_tag_get_tags' => array( 1144 'classname' => 'core_tag_external', 1145 'methodname' => 'get_tags', 1146 'description' => 'Gets tags by their ids', 1147 'type' => 'read', 1148 'ajax' => true 1149 ), 1150 1151); 1152 1153$services = array( 1154 'Moodle mobile web service' => array( 1155 'functions' => array ( 1156 'moodle_enrol_get_users_courses', 1157 'moodle_enrol_get_enrolled_users', 1158 'moodle_user_get_users_by_id', 1159 'moodle_webservice_get_siteinfo', 1160 'moodle_notes_create_notes', 1161 'moodle_user_get_course_participants_by_id', 1162 'moodle_user_get_users_by_courseid', 1163 'moodle_message_send_instantmessages', 1164 'core_course_get_contents', 1165 'core_get_component_strings', 1166 'core_user_add_user_device', 1167 'core_calendar_get_calendar_events', 1168 'core_enrol_get_users_courses', 1169 'core_enrol_get_enrolled_users', 1170 'core_enrol_get_course_enrolment_methods', 1171 'enrol_self_enrol_user', 1172 'enrol_self_get_instance_info', 1173 'core_user_get_users_by_id', 1174 'core_webservice_get_site_info', 1175 'core_notes_create_notes', 1176 'core_user_get_course_user_profiles', 1177 'core_message_send_instant_messages', 1178 'mod_assign_get_grades', 1179 'mod_assign_get_assignments', 1180 'mod_assign_get_submissions', 1181 'mod_assign_get_user_flags', 1182 'mod_assign_set_user_flags', 1183 'mod_assign_get_user_mappings', 1184 'mod_assign_revert_submissions_to_draft', 1185 'mod_assign_lock_submissions', 1186 'mod_assign_unlock_submissions', 1187 'mod_assign_save_submission', 1188 'mod_assign_submit_for_grading', 1189 'mod_assign_save_grade', 1190 'mod_assign_save_user_extensions', 1191 'mod_assign_reveal_identities', 1192 'message_airnotifier_is_system_configured', 1193 'message_airnotifier_are_notification_preferences_configured', 1194 'core_grades_update_grades', 1195 'mod_forum_get_forums_by_courses', 1196 'mod_forum_get_forum_discussions_paginated', 1197 'mod_forum_get_forum_discussion_posts', 1198 'mod_forum_add_discussion_post', 1199 'mod_forum_add_discussion', 1200 'mod_forum_can_add_discussion', 1201 'core_files_get_files', 1202 'core_message_get_messages', 1203 'core_message_create_contacts', 1204 'core_message_delete_contacts', 1205 'core_message_block_contacts', 1206 'core_message_unblock_contacts', 1207 'core_message_get_contacts', 1208 'core_message_search_contacts', 1209 'core_message_get_blocked_users', 1210 'gradereport_user_get_grades_table', 1211 'core_group_get_course_user_groups', 1212 'core_group_get_activity_allowed_groups', 1213 'core_group_get_activity_groupmode', 1214 'core_user_remove_user_device', 1215 'core_course_get_courses', 1216 'core_completion_update_activity_completion_status_manually', 1217 'core_completion_mark_course_self_completed', 1218 'mod_data_get_databases_by_courses', 1219 'core_comment_get_comments', 1220 'mod_forum_view_forum', 1221 'core_course_view_course', 1222 'core_course_search_courses', 1223 'core_course_get_course_module', 1224 'core_course_get_course_module_by_instance', 1225 'core_completion_get_activities_completion_status', 1226 'core_notes_get_course_notes', 1227 'core_completion_get_course_completion_status', 1228 'core_user_view_user_list', 1229 'core_message_mark_message_read', 1230 'core_message_delete_message', 1231 'core_notes_view_notes', 1232 'mod_forum_view_forum_discussion', 1233 'core_user_view_user_profile', 1234 'gradereport_user_view_grade_report', 1235 'core_rating_get_item_ratings', 1236 'mod_url_view_url', 1237 'core_user_get_users_by_field', 1238 'core_user_add_user_private_files', 1239 'mod_assign_view_grading_table', 1240 'mod_scorm_view_scorm', 1241 'mod_scorm_get_scorm_scoes', 1242 'mod_scorm_get_scorm_user_data', 1243 'mod_scorm_insert_scorm_tracks', 1244 'mod_scorm_get_scorm_sco_tracks', 1245 'mod_scorm_get_scorm_attempt_count', 1246 'mod_scorm_get_scorms_by_courses', 1247 'mod_survey_get_surveys_by_courses', 1248 'mod_survey_view_survey', 1249 'mod_survey_get_questions', 1250 'mod_survey_submit_answers', 1251 'mod_page_view_page', 1252 'mod_resource_view_resource', 1253 'mod_folder_view_folder', 1254 'mod_chat_login_user', 1255 'mod_chat_get_chat_users', 1256 'mod_chat_send_chat_message', 1257 'mod_chat_get_chat_latest_messages', 1258 'mod_chat_view_chat', 1259 'mod_chat_get_chats_by_courses', 1260 'mod_book_view_book', 1261 'mod_book_get_books_by_courses', 1262 'mod_choice_get_choice_results', 1263 'mod_choice_get_choice_options', 1264 'mod_choice_submit_choice_response', 1265 'mod_choice_view_choice', 1266 'mod_choice_get_choices_by_courses', 1267 'mod_choice_delete_choice_responses', 1268 'mod_lti_get_tool_launch_data', 1269 'mod_lti_get_ltis_by_courses', 1270 'mod_lti_view_lti', 1271 'mod_imscp_view_imscp', 1272 'mod_imscp_get_imscps_by_courses', 1273 'mod_glossary_get_glossaries_by_courses', 1274 'mod_wiki_get_wikis_by_courses', 1275 ), 1276 'enabled' => 0, 1277 'restrictedusers' => 0, 1278 'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE, 1279 'downloadfiles' => 1, 1280 'uploadfiles' => 1 1281 ), 1282);