Permalink
Browse files

MDL-16021 dont force mnethost restriction forloading user data based …

…on id
  • Loading branch information...
1 parent a53b72f commit 740972a8263e065405d0397b9681a2a2ddb53c86 peterbulmer committed Aug 14, 2008
Showing with 12 additions and 11 deletions.
  1. +12 −11 lib/moodlelib.php
View
@@ -2875,17 +2875,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;
- }
- $mnethostid = (int)$mnethostid;
- $constraints .= ' AND mnethostid = \''.$mnethostid.'\'';
+ // 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;
+ }
/// Get all the basic user data

0 comments on commit 740972a

Please sign in to comment.