MDL-16021 dont force mnethost restriction forloading user data based on id

This commit is contained in:
peterbulmer
2008-08-14 23:45:32 +00:00
parent 2c352e9940
commit 9bf3e1887d
+11 -10
View File
@@ -3298,17 +3298,18 @@ function get_complete_user_data($field, $value, $mnethostid=null) {
$constraints = $field .' = \''. $value .'\' AND deleted <> \'1\'';
if (is_null($mnethostid)) {
// if null, we restrict to local users
// ** testing for local user can be done with
// mnethostid = $CFG->mnet_localhost_id
// or with
// auth != 'mnet'
// but the first one is FAST with our indexes
$mnethostid = $CFG->mnet_localhost_id;
// If we are loading user data based on anything other than id,
// we must also restrict our search based on mnet host.
if ($field != 'id') {
if (empty($mnethostid)) {
// if empty, we restrict to local users
$mnethostid = $CFG->mnet_localhost_id;
}
}
if (!empty($mnethostid)) {
$mnethostid = (int)$mnethostid;
$constraints .= ' AND mnethostid = ' . $mnethostid;
}
$mnethostid = (int)$mnethostid;
$constraints .= ' AND mnethostid = \''.$mnethostid.'\'';
/// Get all the basic user data