mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-49414 user: Fixing unmanaged conflict
This commit is contained in:
parent
7cbb29e264
commit
537e08ac03
@ -746,115 +746,6 @@ class core_user_external extends external_api {
|
||||
*
|
||||
* @return external_function_parameters
|
||||
* @since Moodle 2.2
|
||||
<<<<<<< HEAD
|
||||
* @deprecated Moodle 2.5 MDL-38030 - Please do not call this function any more.
|
||||
* @see core_user_external::get_users_by_field_parameters()
|
||||
*/
|
||||
public static function get_users_by_id_parameters() {
|
||||
return new external_function_parameters(
|
||||
array(
|
||||
'userids' => new external_multiple_structure(
|
||||
new external_value(core_user::get_property_type('id'), 'user ID')
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user information
|
||||
* - This function is matching the permissions of /user/profil.php
|
||||
* - It is also matching some permissions from /user/editadvanced.php for the following fields:
|
||||
* auth, confirmed, idnumber, lang, theme, timezone, mailformat
|
||||
*
|
||||
* @param array $userids array of user ids
|
||||
* @return array An array of arrays describing users
|
||||
* @since Moodle 2.2
|
||||
* @deprecated Moodle 2.5 MDL-38030 - Please do not call this function any more.
|
||||
* @see core_user_external::get_users_by_field()
|
||||
*/
|
||||
public static function get_users_by_id($userids) {
|
||||
global $CFG, $USER, $DB;
|
||||
require_once($CFG->dirroot . "/user/lib.php");
|
||||
|
||||
$params = self::validate_parameters(self::get_users_by_id_parameters(),
|
||||
array('userids' => $userids));
|
||||
|
||||
list($sqluserids, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
|
||||
$uselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
|
||||
$ujoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = :contextlevel)";
|
||||
$params['contextlevel'] = CONTEXT_USER;
|
||||
$usersql = "SELECT u.* $uselect
|
||||
FROM {user} u $ujoin
|
||||
WHERE u.id $sqluserids";
|
||||
$users = $DB->get_recordset_sql($usersql, $params);
|
||||
|
||||
$result = array();
|
||||
$hasuserupdatecap = has_capability('moodle/user:update', context_system::instance());
|
||||
foreach ($users as $user) {
|
||||
if (!empty($user->deleted)) {
|
||||
continue;
|
||||
}
|
||||
context_helper::preload_from_record($user);
|
||||
$usercontext = context_user::instance($user->id, IGNORE_MISSING);
|
||||
self::validate_context($usercontext);
|
||||
$currentuser = ($user->id == $USER->id);
|
||||
|
||||
if ($userarray = user_get_user_details($user)) {
|
||||
// Fields matching permissions from /user/editadvanced.php.
|
||||
if ($currentuser or $hasuserupdatecap) {
|
||||
$userarray['auth'] = $user->auth;
|
||||
$userarray['confirmed'] = $user->confirmed;
|
||||
$userarray['idnumber'] = $user->idnumber;
|
||||
$userarray['lang'] = $user->lang;
|
||||
$userarray['theme'] = $user->theme;
|
||||
$userarray['timezone'] = $user->timezone;
|
||||
$userarray['mailformat'] = $user->mailformat;
|
||||
}
|
||||
$result[] = $userarray;
|
||||
}
|
||||
}
|
||||
$users->close();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of method result value
|
||||
*
|
||||
* @return external_description
|
||||
* @since Moodle 2.2
|
||||
* @deprecated Moodle 2.5 MDL-38030 - Please do not call this function any more.
|
||||
* @see core_user_external::get_users_by_field_returns()
|
||||
*/
|
||||
public static function get_users_by_id_returns() {
|
||||
$additionalfields = array (
|
||||
'enrolledcourses' => new external_multiple_structure(
|
||||
new external_single_structure(
|
||||
array(
|
||||
'id' => new external_value(PARAM_INT, 'Id of the course'),
|
||||
'fullname' => new external_value(PARAM_RAW, 'Fullname of the course'),
|
||||
'shortname' => new external_value(PARAM_RAW, 'Shortname of the course')
|
||||
)
|
||||
), 'Courses where the user is enrolled - limited by which courses the user is able to see', VALUE_OPTIONAL));
|
||||
return new external_multiple_structure(self::user_description($additionalfields));
|
||||
}
|
||||
|
||||
/**
|
||||
* Marking the method as deprecated.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function get_users_by_id_is_deprecated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of method parameters
|
||||
*
|
||||
* @return external_function_parameters
|
||||
* @since Moodle 2.2
|
||||
=======
|
||||
>>>>>>> MDL-49414 webservices: Remove deprecated functions
|
||||
*/
|
||||
public static function get_course_user_profiles_parameters() {
|
||||
return new external_function_parameters(
|
||||
|
Loading…
x
Reference in New Issue
Block a user