aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712009-03-20 17:25:12 +0000
committerlbsa712009-03-20 17:25:12 +0000
commit613201e22045166d5a22f7bc1ef75ebe6639b1de (patch)
tree63ffa8749297b61318d78b6911d5ef21d8d60351
parentEnsure the remembered velocity is zero when physical is turned off on a prim.... (diff)
downloadopensim-SC_OLD-613201e22045166d5a22f7bc1ef75ebe6639b1de.zip
opensim-SC_OLD-613201e22045166d5a22f7bc1ef75ebe6639b1de.tar.gz
opensim-SC_OLD-613201e22045166d5a22f7bc1ef75ebe6639b1de.tar.bz2
opensim-SC_OLD-613201e22045166d5a22f7bc1ef75ebe6639b1de.tar.xz
* Normalized and pulled GetInventorySkeleton up.
-rw-r--r--OpenSim/Client/Linden/LLStandaloneLoginService.cs34
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs110
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserLoginService.cs62
3 files changed, 79 insertions, 127 deletions
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
index cf63103..2c97eee 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
@@ -201,46 +201,12 @@ namespace OpenSim.Client.Linden
201 201
202 if (m_regionsConnector.RegionLoginsEnabled) 202 if (m_regionsConnector.RegionLoginsEnabled)
203 { 203 {
204 // m_log.Info("[LLStandaloneLoginModule] Informing region about user");
205 return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent); 204 return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent);
206 } 205 }
207 206
208 return false; 207 return false;
209 } 208 }
210 209
211 // See LoginService
212 protected override InventoryData GetInventorySkeleton(UUID userID)
213 {
214 List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
215
216 // If we have user auth but no inventory folders for some reason, create a new set of folders.
217 if (null == folders || 0 == folders.Count)
218 {
219 m_inventoryService.CreateNewUserInventory(userID);
220 folders = m_inventoryService.GetInventorySkeleton(userID);
221 }
222
223 UUID rootID = UUID.Zero;
224 ArrayList AgentInventoryArray = new ArrayList();
225 Hashtable TempHash;
226 foreach (InventoryFolderBase InvFolder in folders)
227 {
228 if (InvFolder.ParentID == UUID.Zero)
229 {
230 rootID = InvFolder.ID;
231 }
232 TempHash = new Hashtable();
233 TempHash["name"] = InvFolder.Name;
234 TempHash["parent_id"] = InvFolder.ParentID.ToString();
235 TempHash["version"] = (Int32)InvFolder.Version;
236 TempHash["type_default"] = (Int32)InvFolder.Type;
237 TempHash["folder_id"] = InvFolder.ID.ToString();
238 AgentInventoryArray.Add(TempHash);
239 }
240
241 return new InventoryData(AgentInventoryArray, rootID);
242 }
243
244 public override void LogOffUser(UserProfileData theUser, string message) 210 public override void LogOffUser(UserProfileData theUser, string message)
245 { 211 {
246 RegionInfo SimInfo; 212 RegionInfo SimInfo;
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index b84f5b6..99b5df7 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -90,13 +90,6 @@ namespace OpenSim.Framework.Communications
90 { 90 {
91 } 91 }
92 92
93 /// <summary>
94 /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
95 /// </summary>
96 /// <param name="userID"></param>
97 /// <returns></returns>
98 /// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
99 protected abstract InventoryData GetInventorySkeleton(UUID userID);
100 93
101 /// <summary> 94 /// <summary>
102 /// Called when we receive the client's initial XMLRPC login_to_simulator request message 95 /// Called when we receive the client's initial XMLRPC login_to_simulator request message
@@ -107,13 +100,13 @@ namespace OpenSim.Framework.Communications
107 { 100 {
108 // Temporary fix 101 // Temporary fix
109 m_loginMutex.WaitOne(); 102 m_loginMutex.WaitOne();
110 103
111 try 104 try
112 { 105 {
113 //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. 106 //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this.
114 //CKF: m_log.Info("[LOGIN]: Attempting login now..."); 107 //CKF: m_log.Info("[LOGIN]: Attempting login now...");
115 XmlRpcResponse response = new XmlRpcResponse(); 108 XmlRpcResponse response = new XmlRpcResponse();
116 Hashtable requestData = (Hashtable) request.Params[0]; 109 Hashtable requestData = (Hashtable)request.Params[0];
117 110
118 SniffLoginKey((Uri)request.Params[2], requestData); 111 SniffLoginKey((Uri)request.Params[2], requestData);
119 112
@@ -301,14 +294,14 @@ namespace OpenSim.Framework.Communications
301 { 294 {
302 if (requestData.Contains("passwd")) 295 if (requestData.Contains("passwd"))
303 { 296 {
304 string passwd = (string) requestData["passwd"]; 297 string passwd = (string)requestData["passwd"];
305 GoodLogin = AuthenticateUser(userProfile, passwd); 298 GoodLogin = AuthenticateUser(userProfile, passwd);
306 } 299 }
307 if (!GoodLogin && (requestData.Contains("web_login_key"))) 300 if (!GoodLogin && (requestData.Contains("web_login_key")))
308 { 301 {
309 try 302 try
310 { 303 {
311 UUID webloginkey = new UUID((string) requestData["web_login_key"]); 304 UUID webloginkey = new UUID((string)requestData["web_login_key"]);
312 GoodLogin = AuthenticateUser(userProfile, webloginkey); 305 GoodLogin = AuthenticateUser(userProfile, webloginkey);
313 } 306 }
314 catch (Exception e) 307 catch (Exception e)
@@ -372,7 +365,7 @@ namespace OpenSim.Framework.Communications
372 m_log.Info("[LOGIN]: LLSD StartLocation Requested: " + map["start"].AsString()); 365 m_log.Info("[LOGIN]: LLSD StartLocation Requested: " + map["start"].AsString());
373 startLocationRequest = map["start"].AsString(); 366 startLocationRequest = map["start"].AsString();
374 } 367 }
375 m_log.Info("[LOGIN]: LLSD Login Requested for: '" + firstname+"' '"+lastname+"' / "+passwd); 368 m_log.Info("[LOGIN]: LLSD Login Requested for: '" + firstname + "' '" + lastname + "' / " + passwd);
376 369
377 if (!TryAuthenticateLLSDLogin(firstname, lastname, passwd, out userProfile)) 370 if (!TryAuthenticateLLSDLogin(firstname, lastname, passwd, out userProfile))
378 { 371 {
@@ -385,7 +378,7 @@ namespace OpenSim.Framework.Communications
385 else 378 else
386 return logResponse.CreateLoginFailedResponseLLSD(); 379 return logResponse.CreateLoginFailedResponseLLSD();
387 380
388 381
389 if (userProfile.GodLevel < m_minLoginLevel) 382 if (userProfile.GodLevel < m_minLoginLevel)
390 { 383 {
391 return logResponse.CreateLoginBlockedResponseLLSD(); 384 return logResponse.CreateLoginBlockedResponseLLSD();
@@ -520,7 +513,7 @@ namespace OpenSim.Framework.Communications
520 string firstname = String.Empty; 513 string firstname = String.Empty;
521 string lastname = String.Empty; 514 string lastname = String.Empty;
522 string location = String.Empty; 515 string location = String.Empty;
523 string region =String.Empty; 516 string region = String.Empty;
524 string grid = String.Empty; 517 string grid = String.Empty;
525 string channel = String.Empty; 518 string channel = String.Empty;
526 string version = String.Empty; 519 string version = String.Empty;
@@ -560,7 +553,7 @@ namespace OpenSim.Framework.Communications
560 lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999); 553 lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999);
561 554
562 if (keysvals.Contains("password")) 555 if (keysvals.Contains("password"))
563 password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999); 556 password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999);
564 557
565 // load our login form. 558 // load our login form.
566 string loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); 559 string loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages);
@@ -578,11 +571,11 @@ namespace OpenSim.Framework.Communications
578 UUID webloginkey = UUID.Random(); 571 UUID webloginkey = UUID.Random();
579 m_userManager.StoreWebLoginKey(user.ID, webloginkey); 572 m_userManager.StoreWebLoginKey(user.ID, webloginkey);
580 //statuscode = 301; 573 //statuscode = 301;
581 574
582// string redirectURL = "about:blank?redirect-http-hack=" + 575 // string redirectURL = "about:blank?redirect-http-hack=" +
583// HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + 576 // HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" +
584// lastname + 577 // lastname +
585// "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); 578 // "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString());
586 //m_log.Info("[WEB]: R:" + redirectURL); 579 //m_log.Info("[WEB]: R:" + redirectURL);
587 returnactions["int_response_code"] = statuscode; 580 returnactions["int_response_code"] = statuscode;
588 //returnactions["str_redirect_location"] = redirectURL; 581 //returnactions["str_redirect_location"] = redirectURL;
@@ -612,7 +605,7 @@ namespace OpenSim.Framework.Communications
612 { 605 {
613 // inject our values in the form at the markers 606 // inject our values in the form at the markers
614 607
615 string loginform=String.Empty; 608 string loginform = String.Empty;
616 string file = Path.Combine(Util.configDir(), "http_loginform.html"); 609 string file = Path.Combine(Util.configDir(), "http_loginform.html");
617 if (!File.Exists(file)) 610 if (!File.Exists(file))
618 { 611 {
@@ -753,7 +746,7 @@ namespace OpenSim.Framework.Communications
753 m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.FirstName, profile.SurName, profile.ID); 746 m_log.InfoFormat("[LOGIN]: Authenticating {0} {1} ({2})", profile.FirstName, profile.SurName, profile.ID);
754 747
755 // Match web login key unless it's the default weblogin key UUID.Zero 748 // Match web login key unless it's the default weblogin key UUID.Zero
756 passwordSuccess = ((profile.WebLoginKey==webloginkey) && profile.WebLoginKey != UUID.Zero); 749 passwordSuccess = ((profile.WebLoginKey == webloginkey) && profile.WebLoginKey != UUID.Zero);
757 750
758 return passwordSuccess; 751 return passwordSuccess;
759 } 752 }
@@ -801,7 +794,7 @@ namespace OpenSim.Framework.Communications
801 LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend); 794 LoginResponse.BuddyList.BuddyInfo buddyitem = new LoginResponse.BuddyList.BuddyInfo(fl.Friend);
802 buddyitem.BuddyID = fl.Friend; 795 buddyitem.BuddyID = fl.Friend;
803 buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms; 796 buddyitem.BuddyRightsHave = (int)fl.FriendListOwnerPerms;
804 buddyitem.BuddyRightsGiven = (int) fl.FriendPerms; 797 buddyitem.BuddyRightsGiven = (int)fl.FriendPerms;
805 buddylistreturn.AddNewBuddy(buddyitem); 798 buddylistreturn.AddNewBuddy(buddyitem);
806 } 799 }
807 return buddylistreturn; 800 return buddylistreturn;
@@ -996,14 +989,6 @@ namespace OpenSim.Framework.Communications
996 return false; 989 return false;
997 } 990 }
998 991
999 // Customise the response
1000 //response.Home =
1001 // string.Format(
1002 // "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
1003 // (SimInfo.regionLocX * Constants.RegionSize),
1004 // (SimInfo.regionLocY*Constants.RegionSize),
1005 // theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
1006 // theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
1007 theUser.CurrentAgent.Position = new Vector3(128, 128, 0); 992 theUser.CurrentAgent.Position = new Vector3(128, 128, 0);
1008 response.StartLocation = "safe"; 993 response.StartLocation = "safe";
1009 994
@@ -1041,5 +1026,68 @@ namespace OpenSim.Framework.Communications
1041 } 1026 }
1042 response.ActiveGestures = list; 1027 response.ActiveGestures = list;
1043 } 1028 }
1029
1030 /// <summary>
1031 /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
1032 /// </summary>
1033 /// <param name="userID"></param>
1034 /// <returns></returns>
1035 /// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
1036 protected InventoryData GetInventorySkeleton(UUID userID)
1037 {
1038 List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
1039
1040 // If we have user auth but no inventory folders for some reason, create a new set of folders.
1041 if (folders == null || folders.Count == 0)
1042 {
1043 m_log.InfoFormat(
1044 "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
1045
1046 // Although the create user function creates a new agent inventory along with a new user profile, some
1047 // tools are creating the user profile directly in the database without creating the inventory. At
1048 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
1049 // exist.
1050 if (!m_inventoryService.CreateNewUserInventory(userID))
1051 {
1052 throw new Exception(
1053 String.Format(
1054 "The inventory creation request for user {0} did not succeed."
1055 + " Please contact your inventory service provider for more information.",
1056 userID));
1057 }
1058
1059 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
1060
1061 folders = m_inventoryService.GetInventorySkeleton(userID);
1062
1063 if (folders == null || folders.Count == 0)
1064 {
1065 throw new Exception(
1066 String.Format(
1067 "A root inventory folder for user {0} could not be retrieved from the inventory service",
1068 userID));
1069 }
1070 }
1071
1072 UUID rootID = UUID.Zero;
1073 ArrayList AgentInventoryArray = new ArrayList();
1074 Hashtable TempHash;
1075 foreach (InventoryFolderBase InvFolder in folders)
1076 {
1077 if (InvFolder.ParentID == UUID.Zero)
1078 {
1079 rootID = InvFolder.ID;
1080 }
1081 TempHash = new Hashtable();
1082 TempHash["name"] = InvFolder.Name;
1083 TempHash["parent_id"] = InvFolder.ParentID.ToString();
1084 TempHash["version"] = (Int32)InvFolder.Version;
1085 TempHash["type_default"] = (Int32)InvFolder.Type;
1086 TempHash["folder_id"] = InvFolder.ID.ToString();
1087 AgentInventoryArray.Add(TempHash);
1088 }
1089
1090 return new InventoryData(AgentInventoryArray, rootID);
1091 }
1044 } 1092 }
1045} 1093}
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
index f3287a7..b354630 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
@@ -364,68 +364,6 @@ namespace OpenSim.Grid.UserServer.Modules
364 return true; 364 return true;
365 } 365 }
366 366
367 // See LoginService
368 protected override InventoryData GetInventorySkeleton(UUID userID)
369 {
370 m_log.DebugFormat(
371 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
372 m_config.InventoryUrl, userID);
373
374 List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
375
376 if (null == folders || folders.Count == 0)
377 {
378 m_log.InfoFormat(
379 "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
380
381 // Although the create user function creates a new agent inventory along with a new user profile, some
382 // tools are creating the user profile directly in the database without creating the inventory. At
383 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
384 // exist.
385 if (!m_inventoryService.CreateNewUserInventory(userID))
386 {
387 throw new Exception(
388 String.Format(
389 "The inventory creation request for user {0} did not succeed."
390 + " Please contact your inventory service provider for more information.",
391 userID));
392 }
393 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
394
395 folders = m_inventoryService.GetInventorySkeleton(userID);
396 }
397
398 if (folders != null && folders.Count > 0)
399 {
400 UUID rootID = UUID.Zero;
401 ArrayList AgentInventoryArray = new ArrayList();
402 Hashtable TempHash;
403
404 foreach (InventoryFolderBase InvFolder in folders)
405 {
406 // m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
407
408 if (InvFolder.ParentID == UUID.Zero)
409 {
410 rootID = InvFolder.ID;
411 }
412 TempHash = new Hashtable();
413 TempHash["name"] = InvFolder.Name;
414 TempHash["parent_id"] = InvFolder.ParentID.ToString();
415 TempHash["version"] = (Int32)InvFolder.Version;
416 TempHash["type_default"] = (Int32)InvFolder.Type;
417 TempHash["folder_id"] = InvFolder.ID.ToString();
418 AgentInventoryArray.Add(TempHash);
419 }
420
421 return new InventoryData(AgentInventoryArray, rootID);
422 }
423 throw new Exception(
424 String.Format(
425 "A root inventory folder for user {0} could not be retrieved from the inventory service",
426 userID));
427 }
428
429 public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request) 367 public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request)
430 { 368 {
431 XmlRpcResponse response = new XmlRpcResponse(); 369 XmlRpcResponse response = new XmlRpcResponse();