From 98dbda9590753e7bd95e4c4ce8c1859e4e24a7f1 Mon Sep 17 00:00:00 2001
From: Penny Leach <penny@liip.ch>
Date: Mon, 11 Jan 2010 22:20:11 +0000
Subject: [PATCH] mnet: MDL-21298 fixed a very unhelpful error message (and
 saved a db query)

this just modifies the nolocaluser string, rather than adding nolocaluser2 like I did in stable.

Merged from MOODLE_19_STABLE
---
 auth/mnet/auth.php    | 6 ++----
 lang/en_utf8/mnet.php | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php
index ab077213b4..84240166a6 100644
--- a/auth/mnet/auth.php
+++ b/auth/mnet/auth.php
@@ -296,11 +296,9 @@ class auth_plugin_mnet extends auth_plugin_base {
             }
             $remoteuser->mnethostid = $remotehost->id;
             $remoteuser->firstaccess = time(); // First time user in this server, grab it here
-            $DB->insert_record('user', $remoteuser);
+            $remoteuser->id = $DB->insert_record('user', $remoteuser);
             $firsttime = true;
-            if (! $localuser = $DB->get_record('user', array('username'=>$remoteuser->username, 'mnethostid'=>$remotehost->id))) {
-                print_error('nolocaluser', 'mnet');
-            }
+            $localuser = $remoteuser;
         }
 
         // check sso access control list for permission first
diff --git a/lang/en_utf8/mnet.php b/lang/en_utf8/mnet.php
index 4fb35a5f81..b1824dc1b8 100644
--- a/lang/en_utf8/mnet.php
+++ b/lang/en_utf8/mnet.php
@@ -216,7 +216,7 @@ $string['authfail_usermismatch'] = 'Authorisation failed: the user does not matc
 $string['hostnotconfiguredforsso'] = 'This remote Moodle Hub is not configured for remote login.';
 $string['authmnetdisabled'] = 'Moodle Networking authentication is disabled.';
 $string['unknownerror'] = 'Unknown error occurred during negotiation.';
-$string['nolocaluser'] = 'No local record exists for remote user.';
+$string['nolocaluser'] = 'No local record exists for remote user, and it could not be created, as this host will not auto create users.  Please contact your administrator!';
 $string['databaseerror'] = 'Could not write details to the database.';
 $string['ssoacldescr'] = 'Use this page to grant/deny access to specific users from remote Moodle Network hosts. This is functional when you are offering SSO services to remote users. To control your <em>local</em> users\' ability to roam to other Moodle Network hosts, use the roles system to grant them the <em>mnetlogintoremote</em> capability.';
 $string['ssoaclneeds'] = 'For this functionality to work, you must have Moodle Networking On, plus the Moodle Network authentication plugin enabled with auto-add users enabled .';
-- 
2.39.5