aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorJustin Clarke Casey2007-12-15 21:58:07 +0000
committerJustin Clarke Casey2007-12-15 21:58:07 +0000
commit019d6626068920283b700440e780c86c162ca7c6 (patch)
tree7c0a9ec1ca185257cee0463a73feef882be23878 /OpenSim/Framework
parentmore dorking around with exporter. Still far (diff)
downloadopensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.zip
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.gz
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.bz2
opensim-SC_OLD-019d6626068920283b700440e780c86c162ca7c6.tar.xz
Put out a more comprehensible message when user authentication fails than the current NullReferenceException based one
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs63
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs16
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs23
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs23
-rw-r--r--OpenSim/Framework/IUserData.cs11
-rw-r--r--OpenSim/Framework/IUserService.cs2
6 files changed, 28 insertions, 110 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
38namespace OpenSim.Framework.UserManagement 38namespace 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
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index c235e96..80b65c1 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -62,16 +62,6 @@ namespace OpenSim.Framework.Data.MSSQL
62 } 62 }
63 63
64 /// <summary> 64 /// <summary>
65 /// Searches the database for a specified user profile
66 /// </summary>
67 /// <param name="name">The account name of the user</param>
68 /// <returns>A user profile</returns>
69 public UserProfileData GetUserByName(string name)
70 {
71 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
72 }
73
74 /// <summary>
75 /// Searches the database for a specified user profile by name components 65 /// Searches the database for a specified user profile by name components
76 /// </summary> 66 /// </summary>
77 /// <param name="user">The first part of the account name</param> 67 /// <param name="user">The first part of the account name</param>
@@ -188,11 +178,7 @@ namespace OpenSim.Framework.Data.MSSQL
188 return returnlist; 178 return returnlist;
189 } 179 }
190 180
191 /// <summary> 181 // See IUserData
192 /// Searches the database for a specified user profile by UUID
193 /// </summary>
194 /// <param name="uuid">The account ID</param>
195 /// <returns>The users profile</returns>
196 public UserProfileData GetUserByUUID(LLUUID uuid) 182 public UserProfileData GetUserByUUID(LLUUID uuid)
197 { 183 {
198 try 184 try
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index e5cbe45..6a7cf49 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -113,23 +113,8 @@ namespace OpenSim.Framework.Data.MySQL
113 } 113 }
114 114
115 #endregion 115 #endregion
116
117 /// <summary>
118 /// Searches the database for a specified user profile
119 /// </summary>
120 /// <param name="name">The account name of the user</param>
121 /// <returns>A user profile</returns>
122 public UserProfileData GetUserByName(string name)
123 {
124 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
125 }
126 116
127 /// <summary> 117 // see IUserData
128 /// Searches the database for a specified user profile by name components
129 /// </summary>
130 /// <param name="user">The first part of the account name</param>
131 /// <param name="last">The second part of the account name</param>
132 /// <returns>A user profile</returns>
133 public UserProfileData GetUserByName(string user, string last) 118 public UserProfileData GetUserByName(string user, string last)
134 { 119 {
135 try 120 try
@@ -244,11 +229,7 @@ namespace OpenSim.Framework.Data.MySQL
244 return returnlist; 229 return returnlist;
245 } 230 }
246 231
247 /// <summary> 232 // see IUserData
248 /// Searches the database for a specified user profile by UUID
249 /// </summary>
250 /// <param name="uuid">The account ID</param>
251 /// <returns>The users profile</returns>
252 public UserProfileData GetUserByUUID(LLUUID uuid) 233 public UserProfileData GetUserByUUID(LLUUID uuid)
253 { 234 {
254 try 235 try
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index da27277..346febc 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
@@ -72,11 +72,7 @@ namespace OpenSim.Framework.Data.SQLite
72 return; 72 return;
73 } 73 }
74 74
75 /// <summary> 75 // see IUserData
76 /// Loads a specified user profile from a UUID
77 /// </summary>
78 /// <param name="uuid">The user's UUID</param>
79 /// <returns>A user profile</returns>
80 public UserProfileData GetUserByUUID(LLUUID uuid) 76 public UserProfileData GetUserByUUID(LLUUID uuid)
81 { 77 {
82 lock (ds) 78 lock (ds)
@@ -99,22 +95,7 @@ namespace OpenSim.Framework.Data.SQLite
99 } 95 }
100 } 96 }
101 97
102 /// <summary> 98 // see IUserData
103 /// Returns a user by searching for its name
104 /// </summary>
105 /// <param name="name">The user's account name</param>
106 /// <returns>A matching user profile</returns>
107 public UserProfileData GetUserByName(string name)
108 {
109 return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
110 }
111
112 /// <summary>
113 /// Returns a user by searching for its name
114 /// </summary>
115 /// <param name="fname">The first part of the user's account name</param>
116 /// <param name="lname">The second part of the user's account name</param>
117 /// <returns>A matching user profile</returns>
118 public UserProfileData GetUserByName(string fname, string lname) 99 public UserProfileData GetUserByName(string fname, string lname)
119 { 100 {
120 string select = "surname = '" + lname + "' and username = '" + fname + "'"; 101 string select = "surname = '" + lname + "' and username = '" + fname + "'";
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index a32bf6c..0679a68 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -38,18 +38,11 @@ namespace OpenSim.Framework
38 /// <summary> 38 /// <summary>
39 /// Returns a user profile from a database via their UUID 39 /// Returns a user profile from a database via their UUID
40 /// </summary> 40 /// </summary>
41 /// <param name="user">The accounts UUID</param> 41 /// <param name="user">The user's UUID</param>
42 /// <returns>The user data profile</returns> 42 /// <returns>The user data profile. Returns null if no user is found</returns>
43 UserProfileData GetUserByUUID(LLUUID user); 43 UserProfileData GetUserByUUID(LLUUID user);
44 44
45 /// <summary> 45 /// <summary>
46 /// Returns a users profile by searching their username
47 /// </summary>
48 /// <param name="name">The users username</param>
49 /// <returns>The user data profile</returns>
50 UserProfileData GetUserByName(string name);
51
52 /// <summary>
53 /// Returns a users profile by searching their username parts 46 /// Returns a users profile by searching their username parts
54 /// </summary> 47 /// </summary>
55 /// <param name="fname">Account firstname</param> 48 /// <param name="fname">Account firstname</param>
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs
index 298bde5..3440e30 100644
--- a/OpenSim/Framework/IUserService.cs
+++ b/OpenSim/Framework/IUserService.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 public interface IUserService 33 public interface IUserService
34 { 34 {
35 UserProfileData GetUserProfile(string firstName, string lastName); 35 UserProfileData GetUserProfile(string firstName, string lastName);
36 UserProfileData GetUserProfile(string name); 36 //UserProfileData GetUserProfile(string name);
37 UserProfileData GetUserProfile(LLUUID userId); 37 UserProfileData GetUserProfile(LLUUID userId);
38 void clearUserAgent(LLUUID avatarID); 38 void clearUserAgent(LLUUID avatarID);
39 List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query); 39 List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID QueryID, string Query);