diff options
author | Justin Clarke Casey | 2007-12-15 21:58:07 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2007-12-15 21:58:07 +0000 |
commit | 019d6626068920283b700440e780c86c162ca7c6 (patch) | |
tree | 7c0a9ec1ca185257cee0463a73feef882be23878 /OpenSim/Framework/Communications/UserManagerBase.cs | |
parent | more dorking around with exporter. Still far (diff) | |
download | opensim-SC-019d6626068920283b700440e780c86c162ca7c6.zip opensim-SC-019d6626068920283b700440e780c86c162ca7c6.tar.gz opensim-SC-019d6626068920283b700440e780c86c162ca7c6.tar.bz2 opensim-SC-019d6626068920283b700440e780c86c162ca7c6.tar.xz |
Put out a more comprehensible message when user authentication fails than the current NullReferenceException based one
Diffstat (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 63 |
1 files changed, 20 insertions, 43 deletions
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; | |||
37 | 37 | ||
38 | namespace OpenSim.Framework.UserManagement | 38 | namespace OpenSim.Framework.UserManagement |
39 | { | 39 | { |
40 | /// <summary> | ||
41 | /// Base class for user management (create, read, etc) | ||
42 | /// </summary> | ||
40 | public abstract class UserManagerBase : IUserService | 43 | public abstract class UserManagerBase : IUserService |
41 | { | 44 | { |
42 | public UserConfig _config; | 45 | public UserConfig _config; |
@@ -84,22 +87,23 @@ namespace OpenSim.Framework.UserManagement | |||
84 | /// Loads a user profile from a database by UUID | 87 | /// Loads a user profile from a database by UUID |
85 | /// </summary> | 88 | /// </summary> |
86 | /// <param name="uuid">The target UUID</param> | 89 | /// <param name="uuid">The target UUID</param> |
87 | /// <returns>A user profile</returns> | 90 | /// <returns>A user profile. Returns null if no user profile is found.</returns> |
88 | public UserProfileData GetUserProfile(LLUUID uuid) | 91 | public UserProfileData GetUserProfile(LLUUID uuid) |
89 | { | 92 | { |
90 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 93 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
91 | { | 94 | { |
92 | try | 95 | UserProfileData profile = plugin.Value.GetUserByUUID(uuid); |
96 | |||
97 | if (null != profile) | ||
93 | { | 98 | { |
94 | UserProfileData profile = plugin.Value.GetUserByUUID(uuid); | ||
95 | profile.currentAgent = getUserAgent(profile.UUID); | 99 | profile.currentAgent = getUserAgent(profile.UUID); |
96 | return profile; | 100 | return profile; |
97 | } | 101 | } |
98 | catch (Exception e) | ||
99 | { | ||
100 | MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
101 | } | ||
102 | } | 102 | } |
103 | |||
104 | MainLog.Instance.Notice( | ||
105 | "USERSTORAGE", | ||
106 | "Could not find user " + uuid.ToStringHyphenated() + " in persistent storage."); | ||
103 | 107 | ||
104 | return null; | 108 | return null; |
105 | } | 109 | } |
@@ -123,55 +127,28 @@ namespace OpenSim.Framework.UserManagement | |||
123 | return pickerlist; | 127 | return pickerlist; |
124 | } | 128 | } |
125 | 129 | ||
126 | |||
127 | /// <summary> | ||
128 | /// Loads a user profile by name | ||
129 | /// </summary> | ||
130 | /// <param name="name">The target name</param> | ||
131 | /// <returns>A user profile</returns> | ||
132 | public UserProfileData GetUserProfile(string name) | ||
133 | { | ||
134 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
135 | { | ||
136 | try | ||
137 | { | ||
138 | UserProfileData profile = plugin.Value.GetUserByName(name); | ||
139 | profile.currentAgent = getUserAgent(profile.UUID); | ||
140 | return profile; | ||
141 | } | ||
142 | catch (Exception e) | ||
143 | { | ||
144 | MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return null; | ||
149 | } | ||
150 | |||
151 | /// <summary> | 130 | /// <summary> |
152 | /// Loads a user profile by name | 131 | /// Loads a user profile by name |
153 | /// </summary> | 132 | /// </summary> |
154 | /// <param name="fname">First name</param> | 133 | /// <param name="fname">First name</param> |
155 | /// <param name="lname">Last name</param> | 134 | /// <param name="lname">Last name</param> |
156 | /// <returns>A user profile</returns> | 135 | /// <returns>A user profile. Returns null if no profile is found</returns> |
157 | public UserProfileData GetUserProfile(string fname, string lname) | 136 | public UserProfileData GetUserProfile(string fname, string lname) |
158 | { | 137 | { |
159 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | 138 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) |
160 | { | 139 | { |
161 | try | 140 | UserProfileData profile = plugin.Value.GetUserByName(fname, lname); |
162 | { | ||
163 | UserProfileData profile = plugin.Value.GetUserByName(fname, lname); | ||
164 | 141 | ||
142 | if (profile != null) | ||
143 | { | ||
165 | profile.currentAgent = getUserAgent(profile.UUID); | 144 | profile.currentAgent = getUserAgent(profile.UUID); |
166 | |||
167 | return profile; | 145 | return profile; |
168 | } | 146 | } |
169 | catch (Exception e) | ||
170 | { | ||
171 | MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
172 | } | ||
173 | } | 147 | } |
174 | 148 | ||
149 | MainLog.Instance.Notice( | ||
150 | "USERSTORAGE", "Could not find user " + fname + " " + lname + " in persistent storage."); | ||
151 | |||
175 | return null; | 152 | return null; |
176 | } | 153 | } |
177 | 154 | ||