aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2007-05-20 16:39:03 +0000
committerAdam Frisby2007-05-20 16:39:03 +0000
commit7d29bd138f735dcf1f600c62c5ab60c58690fb73 (patch)
tree234114abfcf8586bf984f6ac067a5128551a338b
parentAdding SQL files for new userserver table layouts. (diff)
downloadopensim-SC_OLD-7d29bd138f735dcf1f600c62c5ab60c58690fb73.zip
opensim-SC_OLD-7d29bd138f735dcf1f600c62c5ab60c58690fb73.tar.gz
opensim-SC_OLD-7d29bd138f735dcf1f600c62c5ab60c58690fb73.tar.bz2
opensim-SC_OLD-7d29bd138f735dcf1f600c62c5ab60c58690fb73.tar.xz
Finished adding comments
-rw-r--r--OpenGridServices.UserServer/UserManager.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices.UserServer/UserManager.cs
index c1e442f..b579732 100644
--- a/OpenGridServices.UserServer/UserManager.cs
+++ b/OpenGridServices.UserServer/UserManager.cs
@@ -126,6 +126,11 @@ namespace OpenGridServices.UserServer
126 return null; 126 return null;
127 } 127 }
128 128
129 /// <summary>
130 /// Loads a user agent by uuid (not called directly)
131 /// </summary>
132 /// <param name="uuid">The agents UUID</param>
133 /// <returns>Agent profiles</returns>
129 public UserAgentData getUserAgent(LLUUID uuid) 134 public UserAgentData getUserAgent(LLUUID uuid)
130 { 135 {
131 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 136 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
@@ -143,6 +148,11 @@ namespace OpenGridServices.UserServer
143 return null; 148 return null;
144 } 149 }
145 150
151 /// <summary>
152 /// Loads a user agent by name (not called directly)
153 /// </summary>
154 /// <param name="name">The agents name</param>
155 /// <returns>A user agent</returns>
146 public UserAgentData getUserAgent(string name) 156 public UserAgentData getUserAgent(string name)
147 { 157 {
148 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 158 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
@@ -160,6 +170,12 @@ namespace OpenGridServices.UserServer
160 return null; 170 return null;
161 } 171 }
162 172
173 /// <summary>
174 /// Loads a user agent by name (not called directly)
175 /// </summary>
176 /// <param name="fname">The agents firstname</param>
177 /// <param name="lname">The agents lastname</param>
178 /// <returns>A user agent</returns>
163 public UserAgentData getUserAgent(string fname, string lname) 179 public UserAgentData getUserAgent(string fname, string lname)
164 { 180 {
165 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 181 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
@@ -177,6 +193,10 @@ namespace OpenGridServices.UserServer
177 return null; 193 return null;
178 } 194 }
179 195
196 /// <summary>
197 /// Creates a error response caused by invalid XML
198 /// </summary>
199 /// <returns>An XMLRPC response</returns>
180 private static XmlRpcResponse CreateErrorConnectingToGridResponse() 200 private static XmlRpcResponse CreateErrorConnectingToGridResponse()
181 { 201 {
182 XmlRpcResponse response = new XmlRpcResponse(); 202 XmlRpcResponse response = new XmlRpcResponse();
@@ -188,6 +208,10 @@ namespace OpenGridServices.UserServer
188 return response; 208 return response;
189 } 209 }
190 210
211 /// <summary>
212 /// Creates an error response caused by bad login credentials
213 /// </summary>
214 /// <returns>An XMLRPC response</returns>
191 private static XmlRpcResponse CreateLoginErrorResponse() 215 private static XmlRpcResponse CreateLoginErrorResponse()
192 { 216 {
193 XmlRpcResponse response = new XmlRpcResponse(); 217 XmlRpcResponse response = new XmlRpcResponse();
@@ -199,6 +223,10 @@ namespace OpenGridServices.UserServer
199 return response; 223 return response;
200 } 224 }
201 225
226 /// <summary>
227 /// Creates an error response caused by being logged in already
228 /// </summary>
229 /// <returns>An XMLRPC Response</returns>
202 private static XmlRpcResponse CreateAlreadyLoggedInResponse() 230 private static XmlRpcResponse CreateAlreadyLoggedInResponse()
203 { 231 {
204 XmlRpcResponse response = new XmlRpcResponse(); 232 XmlRpcResponse response = new XmlRpcResponse();
@@ -210,6 +238,11 @@ namespace OpenGridServices.UserServer
210 return response; 238 return response;
211 } 239 }
212 240
241 /// <summary>
242 /// Customises the login response and fills in missing values.
243 /// </summary>
244 /// <param name="response">The existing response</param>
245 /// <param name="theUser">The user profile</param>
213 public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser) 246 public virtual void CustomiseResponse(ref Hashtable response, ref UserProfileData theUser)
214 { 247 {
215 // Load information from the gridserver 248 // Load information from the gridserver
@@ -254,6 +287,12 @@ namespace OpenGridServices.UserServer
254 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000); 287 XmlRpcResponse GridResp = GridReq.Send(SimInfo.caps_url, 3000);
255 } 288 }
256 289
290 /// <summary>
291 /// Checks a user against it's password hash
292 /// </summary>
293 /// <param name="profile">The users profile</param>
294 /// <param name="password">The supplied password</param>
295 /// <returns>Authenticated?</returns>
257 public bool AuthenticateUser(ref UserProfileData profile, string password) 296 public bool AuthenticateUser(ref UserProfileData profile, string password)
258 { 297 {
259 password = password.Remove(0, 3); //remove $1$ 298 password = password.Remove(0, 3); //remove $1$
@@ -272,6 +311,11 @@ namespace OpenGridServices.UserServer
272 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); 311 return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
273 } 312 }
274 313
314 /// <summary>
315 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
316 /// </summary>
317 /// <param name="profile">The users profile</param>
318 /// <param name="request">The users loginrequest</param>
275 public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request) 319 public void CreateAgent(ref UserProfileData profile, XmlRpcRequest request)
276 { 320 {
277 Hashtable requestData = (Hashtable)request.Params[0]; 321 Hashtable requestData = (Hashtable)request.Params[0];
@@ -319,12 +363,22 @@ namespace OpenGridServices.UserServer
319 agent.currentRegion = ""; // Fill in later 363 agent.currentRegion = ""; // Fill in later
320 } 364 }
321 365
366 /// <summary>
367 /// Saves a target agent to the database
368 /// </summary>
369 /// <param name="profile">The users profile</param>
370 /// <returns>Successful?</returns>
322 public bool CommitAgent(ref UserProfileData profile) 371 public bool CommitAgent(ref UserProfileData profile)
323 { 372 {
324 // Saves the agent to database 373 // Saves the agent to database
325 return true; 374 return true;
326 } 375 }
327 376
377 /// <summary>
378 /// Main user login function
379 /// </summary>
380 /// <param name="request">The XMLRPC request</param>
381 /// <returns>The response to send</returns>
328 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 382 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
329 { 383 {
330 XmlRpcResponse response = new XmlRpcResponse(); 384 XmlRpcResponse response = new XmlRpcResponse();
@@ -487,6 +541,13 @@ namespace OpenGridServices.UserServer
487 541
488 } 542 }
489 543
544 /// <summary>
545 /// Deletes an active agent session
546 /// </summary>
547 /// <param name="request">The request</param>
548 /// <param name="path">The path (eg /bork/narf/test)</param>
549 /// <param name="param">Parameters sent</param>
550 /// <returns>Success "OK" else error</returns>
490 public string RestDeleteUserSessionMethod(string request, string path, string param) 551 public string RestDeleteUserSessionMethod(string request, string path, string param)
491 { 552 {
492 // TODO! Important! 553 // TODO! Important!