From 019d6626068920283b700440e780c86c162ca7c6 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sat, 15 Dec 2007 21:58:07 +0000
Subject: Put out a more comprehensible message when user authentication fails
than the current NullReferenceException based one
---
.../Framework/Communications/UserManagerBase.cs | 63 +++++++---------------
1 file changed, 20 insertions(+), 43 deletions(-)
(limited to 'OpenSim/Framework/Communications')
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 0e5e782..a82a58d 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -37,6 +37,9 @@ using OpenSim.Framework.Console;
namespace OpenSim.Framework.UserManagement
{
+ ///
+ /// Base class for user management (create, read, etc)
+ ///
public abstract class UserManagerBase : IUserService
{
public UserConfig _config;
@@ -84,22 +87,23 @@ namespace OpenSim.Framework.UserManagement
/// Loads a user profile from a database by UUID
///
/// The target UUID
- /// A user profile
+ /// A user profile. Returns null if no user profile is found.
public UserProfileData GetUserProfile(LLUUID uuid)
{
foreach (KeyValuePair plugin in _plugins)
{
- try
+ UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
+
+ if (null != profile)
{
- UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
profile.currentAgent = getUserAgent(profile.UUID);
return profile;
- }
- catch (Exception e)
- {
- MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
- }
+ }
}
+
+ MainLog.Instance.Notice(
+ "USERSTORAGE",
+ "Could not find user " + uuid.ToStringHyphenated() + " in persistent storage.");
return null;
}
@@ -123,55 +127,28 @@ namespace OpenSim.Framework.UserManagement
return pickerlist;
}
-
- ///
- /// Loads a user profile by name
- ///
- /// The target name
- /// A user profile
- public UserProfileData GetUserProfile(string name)
- {
- foreach (KeyValuePair plugin in _plugins)
- {
- try
- {
- UserProfileData profile = plugin.Value.GetUserByName(name);
- profile.currentAgent = getUserAgent(profile.UUID);
- return profile;
- }
- catch (Exception e)
- {
- MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
- }
- }
-
- return null;
- }
-
///
/// Loads a user profile by name
///
/// First name
/// Last name
- /// A user profile
+ /// A user profile. Returns null if no profile is found
public UserProfileData GetUserProfile(string fname, string lname)
{
foreach (KeyValuePair plugin in _plugins)
{
- try
- {
- UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
+ UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
+ if (profile != null)
+ {
profile.currentAgent = getUserAgent(profile.UUID);
-
return profile;
}
- catch (Exception e)
- {
- MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
- }
}
-
+
+ MainLog.Instance.Notice(
+ "USERSTORAGE", "Could not find user " + fname + " " + lname + " in persistent storage.");
+
return null;
}
--
cgit v1.1