2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
19 * External course participation api.
21 * This api is mostly read only, the actual enrol and unenrol
22 * support is in each enrol plugin.
26 * @copyright 2010 Jerome Mouneyrac
27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30 defined('MOODLE_INTERNAL') ||
die();
32 require_once("$CFG->libdir/externallib.php");
35 * Enrol external functions
39 * @copyright 2011 Jerome Mouneyrac
40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
43 class core_enrol_external
extends external_api
{
46 * Returns description of method parameters
48 * @return external_function_parameters
50 public static function get_users_courses_parameters() {
51 return new external_function_parameters(
53 'userid' => new external_value(PARAM_INT
, 'user id'),
59 * Get list of courses user is enrolled in (only active enrolments are returned).
60 * Please note the current user must be able to access the course, otherwise the course is not included.
63 * @return array of courses
65 public static function get_users_courses($userid) {
68 // Do basic automatic PARAM checks on incoming data, using params description
69 // If any problems are found then exceptions are thrown with helpful error messages
70 $params = self
::validate_parameters(self
::get_users_courses_parameters(), array('userid'=>$userid));
72 $courses = enrol_get_users_courses($params['userid'], true, 'id, shortname, fullname, idnumber, visible');
75 foreach ($courses as $course) {
76 $context = context_course
::instance($course->id
, IGNORE_MISSING
);
78 self
::validate_context($context);
79 } catch (Exception
$e) {
80 // current user can not access this course, sorry we can not disclose who is enrolled in this course!
84 if ($userid != $USER->id
and !has_capability('moodle/course:viewparticipants', $context)) {
85 // we need capability to view participants
89 list($enrolledsqlselect, $enrolledparams) = get_enrolled_sql($context);
90 $enrolledsql = "SELECT COUNT(*) FROM ($enrolledsqlselect) AS enrolleduserids";
91 $enrolledusercount = $DB->count_records_sql($enrolledsql, $enrolledparams);
93 $result[] = array('id'=>$course->id
, 'shortname'=>$course->shortname
, 'fullname'=>$course->fullname
, 'idnumber'=>$course->idnumber
,'visible'=>$course->visible
, 'enrolledusercount'=>$enrolledusercount);
100 * Returns description of method result value
102 * @return external_description
104 public static function get_users_courses_returns() {
105 return new external_multiple_structure(
106 new external_single_structure(
108 'id' => new external_value(PARAM_INT
, 'id of course'),
109 'shortname' => new external_value(PARAM_RAW
, 'short name of course'),
110 'fullname' => new external_value(PARAM_RAW
, 'long name of course'),
111 'enrolledusercount' => new external_value(PARAM_INT
, 'Number of enrolled users in this course'),
112 'idnumber' => new external_value(PARAM_RAW
, 'id number of course'),
113 'visible' => new external_value(PARAM_INT
, '1 means visible, 0 means hidden course'),
120 * Returns description of method parameters
122 * @return external_function_parameters
124 public static function get_enrolled_users_parameters() {
125 return new external_function_parameters(
127 'courseid' => new external_value(PARAM_INT
, 'course id'),
128 'options' => new external_multiple_structure(
129 new external_single_structure(
131 'name' => new external_value(PARAM_ALPHANUMEXT
, 'option name'),
132 'value' => new external_value(PARAM_RAW
, 'option value')
135 * withcapability (string) return only users with this capability. This option requires \'moodle/role:review\' on the course context.
136 * groupid (integer) return only users in this group id. This option requires \'moodle/site:accessallgroups\' on the course context.
137 * onlyactive (integer) return only users with active enrolments and matching time restrictions. This option requires \'moodle/course:enrolreview\' on the course context.
138 * userfields (\'string, string, ...\') return only the values of these user fields.
139 * limitfrom (integer) sql limit from.
140 * limitnumber (integer) maximum number of returned users.', VALUE_DEFAULT
, array()),
146 * Get course participants details
148 * @param int $courseid course id
149 * @param array $options options {
150 * 'name' => option name
151 * 'value' => option value
153 * @return array An array of users
155 public static function get_enrolled_users($courseid, $options = array()) {
156 global $CFG, $USER, $DB;
157 require_once($CFG->dirroot
. "/user/lib.php");
159 $params = self
::validate_parameters(
160 self
::get_enrolled_users_parameters(),
162 'courseid'=>$courseid,
166 $withcapability = '';
169 $userfields = array();
172 foreach ($options as $option) {
173 switch ($option['name']) {
174 case 'withcapability':
175 $withcapability = $option['value'];
178 $groupid = (int)$option['value'];
181 $onlyactive = !empty($option['value']);
184 $thefields = explode(',', $option['value']);
185 foreach ($thefields as $f) {
186 $userfields[] = clean_param($f, PARAM_ALPHANUMEXT
);
189 $limitfrom = clean_param($option['value'], PARAM_INT
);
192 $limitnumber = clean_param($option['value'], PARAM_INT
);
197 $course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST
);
198 $coursecontext = context_course
::instance($courseid, IGNORE_MISSING
);
199 if ($courseid == SITEID
) {
200 $context = get_system_context();
202 $context = $coursecontext;
205 self
::validate_context($context);
206 } catch (Exception
$e) {
207 $exceptionparam = new stdClass();
208 $exceptionparam->message
= $e->getMessage();
209 $exceptionparam->courseid
= $params['courseid'];
210 throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
213 if ($courseid == SITEID
) {
214 require_capability('moodle/site:viewparticipants', $context);
216 require_capability('moodle/course:viewparticipants', $context);
218 // to overwrite this parameter, you need role:review capability
219 if ($withcapability) {
220 require_capability('moodle/role:review', $coursecontext);
222 // need accessallgroups capability if you want to overwrite this option
223 if (!empty($groupid) && groups_is_member($groupid)) {
224 require_capability('moodle/site:accessallgroups', $coursecontext);
226 // to overwrite this option, you need course:enrolereview permission
228 require_capability('moodle/course:enrolreview', $coursecontext);
231 list($enrolledsql, $enrolledparams) = get_enrolled_sql($coursecontext, $withcapability, $groupid, $onlyactive);
232 list($ctxselect, $ctxjoin) = context_instance_preload_sql('u.id', CONTEXT_USER
, 'ctx');
233 $sqlparams['courseid'] = $courseid;
234 $sql = "SELECT u.* $ctxselect
235 FROM {user} u $ctxjoin
236 WHERE u.id IN ($enrolledsql)
238 $enrolledusers = $DB->get_recordset_sql($sql, $enrolledparams, $limitfrom, $limitnumber);
240 foreach ($enrolledusers as $user) {
241 context_instance_preload($user);
242 if ($userdetails = user_get_user_details($user, $course, $userfields)) {
243 $users[] = $userdetails;
246 $enrolledusers->close();
252 * Returns description of method result value
254 * @return external_description
256 public static function get_enrolled_users_returns() {
257 return new external_multiple_structure(
258 new external_single_structure(
260 'id' => new external_value(PARAM_INT
, 'ID of the user'),
261 'username' => new external_value(PARAM_RAW
, 'Username policy is defined in Moodle security config', VALUE_OPTIONAL
),
262 'firstname' => new external_value(PARAM_NOTAGS
, 'The first name(s) of the user', VALUE_OPTIONAL
),
263 'lastname' => new external_value(PARAM_NOTAGS
, 'The family name of the user', VALUE_OPTIONAL
),
264 'fullname' => new external_value(PARAM_NOTAGS
, 'The fullname of the user'),
265 'email' => new external_value(PARAM_TEXT
, 'An email address - allow email as root@localhost', VALUE_OPTIONAL
),
266 'address' => new external_value(PARAM_TEXT
, 'Postal address', VALUE_OPTIONAL
),
267 'phone1' => new external_value(PARAM_NOTAGS
, 'Phone 1', VALUE_OPTIONAL
),
268 'phone2' => new external_value(PARAM_NOTAGS
, 'Phone 2', VALUE_OPTIONAL
),
269 'icq' => new external_value(PARAM_NOTAGS
, 'icq number', VALUE_OPTIONAL
),
270 'skype' => new external_value(PARAM_NOTAGS
, 'skype id', VALUE_OPTIONAL
),
271 'yahoo' => new external_value(PARAM_NOTAGS
, 'yahoo id', VALUE_OPTIONAL
),
272 'aim' => new external_value(PARAM_NOTAGS
, 'aim id', VALUE_OPTIONAL
),
273 'msn' => new external_value(PARAM_NOTAGS
, 'msn number', VALUE_OPTIONAL
),
274 'department' => new external_value(PARAM_TEXT
, 'department', VALUE_OPTIONAL
),
275 'institution' => new external_value(PARAM_TEXT
, 'institution', VALUE_OPTIONAL
),
276 'idnumber' => new external_value(PARAM_RAW
, 'An arbitrary ID code number perhaps from the institution', VALUE_OPTIONAL
),
277 'interests' => new external_value(PARAM_TEXT
, 'user interests (separated by commas)', VALUE_OPTIONAL
),
278 'firstaccess' => new external_value(PARAM_INT
, 'first access to the site (0 if never)', VALUE_OPTIONAL
),
279 'lastaccess' => new external_value(PARAM_INT
, 'last access to the site (0 if never)', VALUE_OPTIONAL
),
280 'description' => new external_value(PARAM_RAW
, 'User profile description', VALUE_OPTIONAL
),
281 'descriptionformat' => new external_format_value('description', VALUE_OPTIONAL
),
282 'city' => new external_value(PARAM_NOTAGS
, 'Home city of the user', VALUE_OPTIONAL
),
283 'url' => new external_value(PARAM_URL
, 'URL of the user', VALUE_OPTIONAL
),
284 'country' => new external_value(PARAM_ALPHA
, 'Home country code of the user, such as AU or CZ', VALUE_OPTIONAL
),
285 'profileimageurlsmall' => new external_value(PARAM_URL
, 'User image profile URL - small version', VALUE_OPTIONAL
),
286 'profileimageurl' => new external_value(PARAM_URL
, 'User image profile URL - big version', VALUE_OPTIONAL
),
287 'customfields' => new external_multiple_structure(
288 new external_single_structure(
290 'type' => new external_value(PARAM_ALPHANUMEXT
, 'The type of the custom field - text field, checkbox...'),
291 'value' => new external_value(PARAM_RAW
, 'The value of the custom field'),
292 'name' => new external_value(PARAM_RAW
, 'The name of the custom field'),
293 'shortname' => new external_value(PARAM_RAW
, 'The shortname of the custom field - to be able to build the field class in the code'),
295 ), 'User custom fields (also known as user profil fields)', VALUE_OPTIONAL
),
296 'groups' => new external_multiple_structure(
297 new external_single_structure(
299 'id' => new external_value(PARAM_INT
, 'group id'),
300 'name' => new external_value(PARAM_RAW
, 'group name'),
301 'description' => new external_value(PARAM_RAW
, 'group description'),
302 'descriptionformat' => new external_format_value('description'),
304 ), 'user groups', VALUE_OPTIONAL
),
305 'roles' => new external_multiple_structure(
306 new external_single_structure(
308 'roleid' => new external_value(PARAM_INT
, 'role id'),
309 'name' => new external_value(PARAM_RAW
, 'role name'),
310 'shortname' => new external_value(PARAM_ALPHANUMEXT
, 'role shortname'),
311 'sortorder' => new external_value(PARAM_INT
, 'role sortorder')
313 ), 'user roles', VALUE_OPTIONAL
),
314 'preferences' => new external_multiple_structure(
315 new external_single_structure(
317 'name' => new external_value(PARAM_ALPHANUMEXT
, 'The name of the preferences'),
318 'value' => new external_value(PARAM_RAW
, 'The value of the custom field'),
320 ), 'User preferences', VALUE_OPTIONAL
),
321 'enrolledcourses' => new external_multiple_structure(
322 new external_single_structure(
324 'id' => new external_value(PARAM_INT
, 'Id of the course'),
325 'fullname' => new external_value(PARAM_RAW
, 'Fullname of the course'),
326 'shortname' => new external_value(PARAM_RAW
, 'Shortname of the course')
328 ), 'Courses where the user is enrolled - limited by which courses the user is able to see', VALUE_OPTIONAL
)
337 * Role external functions
341 * @copyright 2011 Jerome Mouneyrac
342 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
345 class core_role_external
extends external_api
{
348 * Returns description of method parameters
350 * @return external_function_parameters
352 public static function assign_roles_parameters() {
353 return new external_function_parameters(
355 'assignments' => new external_multiple_structure(
356 new external_single_structure(
358 'roleid' => new external_value(PARAM_INT
, 'Role to assign to the user'),
359 'userid' => new external_value(PARAM_INT
, 'The user that is going to be assigned'),
360 'contextid' => new external_value(PARAM_INT
, 'The context to assign the user role in'),
369 * Manual role assignments to users
371 * @param array $assignments An array of manual role assignment
373 public static function assign_roles($assignments) {
376 // Do basic automatic PARAM checks on incoming data, using params description
377 // If any problems are found then exceptions are thrown with helpful error messages
378 $params = self
::validate_parameters(self
::assign_roles_parameters(), array('assignments'=>$assignments));
380 $transaction = $DB->start_delegated_transaction();
382 foreach ($params['assignments'] as $assignment) {
383 // Ensure the current user is allowed to run this function in the enrolment context
384 $context = context
::instance_by_id($assignment['contextid'], IGNORE_MISSING
);
385 self
::validate_context($context);
386 require_capability('moodle/role:assign', $context);
388 // throw an exception if user is not able to assign the role in this context
389 $roles = get_assignable_roles($context, ROLENAME_SHORT
);
391 if (!key_exists($assignment['roleid'], $roles)) {
392 throw new invalid_parameter_exception('Can not assign roleid='.$assignment['roleid'].' in contextid='.$assignment['contextid']);
395 role_assign($assignment['roleid'], $assignment['userid'], $assignment['contextid']);
398 $transaction->allow_commit();
402 * Returns description of method result value
406 public static function assign_roles_returns() {
412 * Returns description of method parameters
414 * @return external_function_parameters
416 public static function unassign_roles_parameters() {
417 return new external_function_parameters(
419 'unassignments' => new external_multiple_structure(
420 new external_single_structure(
422 'roleid' => new external_value(PARAM_INT
, 'Role to assign to the user'),
423 'userid' => new external_value(PARAM_INT
, 'The user that is going to be assigned'),
424 'contextid' => new external_value(PARAM_INT
, 'The context to unassign the user role from'),
433 * Unassign roles from users
435 * @param array $unassignments An array of unassignment
437 public static function unassign_roles($unassignments) {
440 // Do basic automatic PARAM checks on incoming data, using params description
441 // If any problems are found then exceptions are thrown with helpful error messages
442 $params = self
::validate_parameters(self
::unassign_roles_parameters(), array('unassignments'=>$unassignments));
444 $transaction = $DB->start_delegated_transaction();
446 foreach ($params['unassignments'] as $unassignment) {
447 // Ensure the current user is allowed to run this function in the unassignment context
448 $context = context
::instance_by_id($unassignment['contextid'], IGNORE_MISSING
);
449 self
::validate_context($context);
450 require_capability('moodle/role:assign', $context);
452 // throw an exception if user is not able to unassign the role in this context
453 $roles = get_assignable_roles($context, ROLENAME_SHORT
);
454 if (!key_exists($unassignment['roleid'], $roles)) {
455 throw new invalid_parameter_exception('Can not unassign roleid='.$unassignment['roleid'].' in contextid='.$unassignment['contextid']);
458 role_unassign($unassignment['roleid'], $unassignment['userid'], $unassignment['contextid']);
461 $transaction->allow_commit();
465 * Returns description of method result value
469 public static function unassign_roles_returns() {
476 * Deprecated enrol and role external functions
478 * @package core_enrol
479 * @copyright 2010 Jerome Mouneyrac
480 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
482 * @deprecated Moodle 2.2 MDL-29106 - Please do not use this class any more.
483 * @todo MDL-31194 This will be deleted in Moodle 2.5.
484 * @see core_enrol_external
485 * @see core_role_external
487 class moodle_enrol_external
extends external_api
{
491 * Returns description of method parameters
493 * @return external_function_parameters
495 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
496 * @todo MDL-31194 This will be deleted in Moodle 2.5.
497 * @see core_enrol_external::get_enrolled_users_parameters()
499 public static function get_enrolled_users_parameters() {
500 return new external_function_parameters(
502 'courseid' => new external_value(PARAM_INT
, 'Course id'),
503 'withcapability' => new external_value(PARAM_CAPABILITY
, 'User should have this capability', VALUE_DEFAULT
, null),
504 'groupid' => new external_value(PARAM_INT
, 'Group id, null means all groups', VALUE_DEFAULT
, null),
505 'onlyactive' => new external_value(PARAM_INT
, 'True means only active, false means all participants', VALUE_DEFAULT
, 0),
511 * Get list of course participants.
513 * @param int $courseid
514 * @param text $withcapability
515 * @param int $groupid
516 * @param bool $onlyactive
517 * @return array of course participants
519 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
520 * @todo MDL-31194 This will be deleted in Moodle 2.5.
521 * @see core_enrol_external::get_enrolled_users()
523 public static function get_enrolled_users($courseid, $withcapability = null, $groupid = null, $onlyactive = false) {
524 global $DB, $CFG, $USER;
526 // Do basic automatic PARAM checks on incoming data, using params description
527 // If any problems are found then exceptions are thrown with helpful error messages
528 $params = self
::validate_parameters(self
::get_enrolled_users_parameters(), array(
529 'courseid'=>$courseid,
530 'withcapability'=>$withcapability,
532 'onlyactive'=>$onlyactive)
535 $coursecontext = context_course
::instance($params['courseid'], IGNORE_MISSING
);
536 if ($courseid == SITEID
) {
537 $context = context_system
::instance();
539 $context = $coursecontext;
543 self
::validate_context($context);
544 } catch (Exception
$e) {
545 $exceptionparam = new stdClass();
546 $exceptionparam->message
= $e->getMessage();
547 $exceptionparam->courseid
= $params['courseid'];
548 throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
551 if ($courseid == SITEID
) {
552 require_capability('moodle/site:viewparticipants', $context);
554 require_capability('moodle/course:viewparticipants', $context);
557 if ($withcapability) {
558 require_capability('moodle/role:review', $coursecontext);
560 if ($groupid && groups_is_member($groupid)) {
561 require_capability('moodle/site:accessallgroups', $coursecontext);
564 require_capability('moodle/course:enrolreview', $coursecontext);
567 list($sqlparams, $params) = get_enrolled_sql($coursecontext, $withcapability, $groupid, $onlyactive);
568 $sql = "SELECT ue.userid, e.courseid, u.firstname, u.lastname, u.username, c.id as usercontextid
569 FROM {user_enrolments} ue
570 JOIN {enrol} e ON (e.id = ue.enrolid)
571 JOIN {user} u ON (ue.userid = u.id)
572 JOIN {context} c ON (u.id = c.instanceid AND contextlevel = " . CONTEXT_USER
. ")
573 WHERE e.courseid = :courseid AND ue.userid IN ($sqlparams)
574 GROUP BY ue.userid, e.courseid, u.firstname, u.lastname, u.username, c.id";
575 $params['courseid'] = $courseid;
576 $enrolledusers = $DB->get_records_sql($sql, $params);
578 $isadmin = is_siteadmin($USER);
579 $canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
580 foreach ($enrolledusers as $enrolleduser) {
581 $profilimgurl = moodle_url
::make_pluginfile_url($enrolleduser->usercontextid
, 'user', 'icon', NULL, '/', 'f1');
582 $profilimgurlsmall = moodle_url
::make_pluginfile_url($enrolleduser->usercontextid
, 'user', 'icon', NULL, '/', 'f2');
584 'courseid' => $enrolleduser->courseid
,
585 'userid' => $enrolleduser->userid
,
586 'fullname' => fullname($enrolleduser),
587 'profileimgurl' => $profilimgurl->out(false),
588 'profileimgurlsmall' => $profilimgurlsmall->out(false)
590 // check if we can return username
592 $resultuser['username'] = $enrolleduser->username
;
594 // check if we can return first and last name
595 if ($isadmin or $canviewfullnames) {
596 $resultuser['firstname'] = $enrolleduser->firstname
;
597 $resultuser['lastname'] = $enrolleduser->lastname
;
599 $result[] = $resultuser;
606 * Returns description of method result value
608 * @return external_description
610 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
611 * @todo MDL-31194 This will be deleted in Moodle 2.5.
612 * @see core_enrol_external::get_enrolled_users_returns()
614 public static function get_enrolled_users_returns() {
615 return new external_multiple_structure(
616 new external_single_structure(
618 'courseid' => new external_value(PARAM_INT
, 'id of course'),
619 'userid' => new external_value(PARAM_INT
, 'id of user'),
620 'firstname' => new external_value(PARAM_RAW
, 'first name of user', VALUE_OPTIONAL
),
621 'lastname' => new external_value(PARAM_RAW
, 'last name of user', VALUE_OPTIONAL
),
622 'fullname' => new external_value(PARAM_RAW
, 'fullname of user'),
623 'username' => new external_value(PARAM_RAW
, 'username of user', VALUE_OPTIONAL
),
624 'profileimgurl' => new external_value(PARAM_URL
, 'url of the profile image'),
625 'profileimgurlsmall' => new external_value(PARAM_URL
, 'url of the profile image (small version)')
632 * Returns description of method parameters
634 * @return external_function_parameters
636 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
637 * @todo MDL-31194 This will be deleted in Moodle 2.5.
638 * @see core_enrol_external::get_users_courses_parameters()
640 public static function get_users_courses_parameters() {
641 return core_enrol_external
::get_users_courses_parameters();
645 * Get list of courses user is enrolled in (only active enrolments are returned).
646 * Please note the current user must be able to access the course, otherwise the course is not included.
649 * @return array of courses
651 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
652 * @todo MDL-31194 This will be deleted in Moodle 2.5.
653 * @see use core_enrol_external::get_users_courses()
655 public static function get_users_courses($userid) {
656 return core_enrol_external
::get_users_courses($userid);
660 * Returns description of method result value
662 * @return external_description
664 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
665 * @todo MDL-31194 This will be deleted in Moodle 2.5.
666 * @see core_enrol_external::get_users_courses_returns()
668 public static function get_users_courses_returns() {
669 return core_enrol_external
::get_users_courses_returns();
674 * Returns description of method parameters
676 * @return external_function_parameters
678 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
679 * @todo MDL-31194 This will be deleted in Moodle 2.5.
680 * @see core_role_external::assign_roles_parameters()
682 public static function role_assign_parameters() {
683 return core_role_external
::assign_roles_parameters();
687 * Manual role assignments to users
689 * @param array $assignments An array of manual role assignment
691 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
692 * @todo MDL-31194 This will be deleted in Moodle 2.5.
693 * @see core_role_external::assign_roles()
695 public static function role_assign($assignments) {
696 return core_role_external
::assign_roles($assignments);
700 * Returns description of method result value
704 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
705 * @todo MDL-31194 This will be deleted in Moodle 2.5.
706 * @see core_role_external::assign_roles_returns()
708 public static function role_assign_returns() {
709 return core_role_external
::assign_roles_returns();
714 * Returns description of method parameters
716 * @return external_function_parameters
718 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
719 * @todo MDL-31194 This will be deleted in Moodle 2.5.
720 * @see core_role_external::unassign_roles_parameters()
722 public static function role_unassign_parameters() {
723 return core_role_external
::unassign_roles_parameters();
727 * Unassign roles from users
729 * @param array $unassignments An array of unassignment
731 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
732 * @todo MDL-31194 This will be deleted in Moodle 2.5.
733 * @see core_role_external::unassign_roles()
735 public static function role_unassign($unassignments) {
736 return core_role_external
::unassign_roles($unassignments);
740 * Returns description of method result value
744 * @deprecated Moodle 2.2 MDL-29106 - Please do not call this function any more.
745 * @todo MDL-31194 This will be deleted in Moodle 2.5.
746 * @see core_role_external::unassign_roles_returns()
748 public static function role_unassign_returns() {
749 return core_role_external
::unassign_roles_returns();