aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Services/HGLoginAuthService.cs2
-rw-r--r--OpenSim/Framework/Communications/Services/LoginService.cs27
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs125
3 files changed, 146 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
index 0637a1e..8e0205c 100644
--- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
+++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Services
78 78
79 m_interServiceInventoryService = interServiceInventoryService; 79 m_interServiceInventoryService = interServiceInventoryService;
80 m_regionsConnector = regionsConnector; 80 m_regionsConnector = regionsConnector;
81 m_inventoryService = interServiceInventoryService; 81 m_interInventoryService = interServiceInventoryService;
82 } 82 }
83 83
84 public void SetServersInfo(NetworkServersInfo sinfo) 84 public void SetServersInfo(NetworkServersInfo sinfo)
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index 900a3d9..7eb98d7 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -41,6 +41,7 @@ using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Communications.Cache; 42using OpenSim.Framework.Communications.Cache;
43using OpenSim.Framework.Statistics; 43using OpenSim.Framework.Statistics;
44using OpenSim.Services.Interfaces;
44 45
45namespace OpenSim.Framework.Communications.Services 46namespace OpenSim.Framework.Communications.Services
46{ 47{
@@ -66,7 +67,9 @@ namespace OpenSim.Framework.Communications.Services
66 /// <summary> 67 /// <summary>
67 /// Used by the login service to make requests to the inventory service. 68 /// Used by the login service to make requests to the inventory service.
68 /// </summary> 69 /// </summary>
69 protected IInterServiceInventoryServices m_inventoryService; 70 protected IInterServiceInventoryServices m_interInventoryService;
71 // Hack
72 protected IInventoryService m_InventoryService;
70 73
71 /// <summary> 74 /// <summary>
72 /// Constructor 75 /// Constructor
@@ -1047,7 +1050,10 @@ namespace OpenSim.Framework.Communications.Services
1047 List<InventoryItemBase> gestures = null; 1050 List<InventoryItemBase> gestures = null;
1048 try 1051 try
1049 { 1052 {
1050 gestures = m_inventoryService.GetActiveGestures(theUser.ID); 1053 if (m_InventoryService != null)
1054 gestures = m_InventoryService.GetActiveGestures(theUser.ID);
1055 else
1056 gestures = m_interInventoryService.GetActiveGestures(theUser.ID);
1051 } 1057 }
1052 catch (Exception e) 1058 catch (Exception e)
1053 { 1059 {
@@ -1076,7 +1082,15 @@ namespace OpenSim.Framework.Communications.Services
1076 /// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception> 1082 /// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
1077 protected InventoryData GetInventorySkeleton(UUID userID) 1083 protected InventoryData GetInventorySkeleton(UUID userID)
1078 { 1084 {
1079 List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); 1085 List<InventoryFolderBase> folders = null;
1086 if (m_InventoryService != null)
1087 {
1088 folders = m_InventoryService.GetInventorySkeleton(userID);
1089 }
1090 else
1091 {
1092 folders = m_interInventoryService.GetInventorySkeleton(userID);
1093 }
1080 1094
1081 // If we have user auth but no inventory folders for some reason, create a new set of folders. 1095 // If we have user auth but no inventory folders for some reason, create a new set of folders.
1082 if (folders == null || folders.Count == 0) 1096 if (folders == null || folders.Count == 0)
@@ -1088,7 +1102,7 @@ namespace OpenSim.Framework.Communications.Services
1088 // tools are creating the user profile directly in the database without creating the inventory. At 1102 // tools are creating the user profile directly in the database without creating the inventory. At
1089 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already 1103 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
1090 // exist. 1104 // exist.
1091 if (!m_inventoryService.CreateNewUserInventory(userID)) 1105 if ((m_interInventoryService != null) && !m_interInventoryService.CreateNewUserInventory(userID))
1092 { 1106 {
1093 throw new Exception( 1107 throw new Exception(
1094 String.Format( 1108 String.Format(
@@ -1099,7 +1113,10 @@ namespace OpenSim.Framework.Communications.Services
1099 1113
1100 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); 1114 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
1101 1115
1102 folders = m_inventoryService.GetInventorySkeleton(userID); 1116 if (m_InventoryService != null)
1117 folders = m_InventoryService.GetInventorySkeleton(userID);
1118 else
1119 folders = m_interInventoryService.GetInventorySkeleton(userID);
1103 1120
1104 if (folders == null || folders.Count == 0) 1121 if (folders == null || folders.Count == 0)
1105 { 1122 {
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 7a622ad..d637ef0 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -39,6 +39,8 @@ using OpenSim.Region.Communications.Local;
39using OpenSim.Tests.Common.Mock; 39using OpenSim.Tests.Common.Mock;
40using OpenSim.Client.Linden; 40using OpenSim.Client.Linden;
41using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
42using OpenSim.Services.Interfaces;
43using OpenMetaverse;
42 44
43namespace OpenSim.Framework.Communications.Tests 45namespace OpenSim.Framework.Communications.Tests
44{ 46{
@@ -73,7 +75,7 @@ namespace OpenSim.Framework.Communications.Tests
73 m_localUserServices = (LocalUserServices) m_commsManager.UserService; 75 m_localUserServices = (LocalUserServices) m_commsManager.UserService;
74 m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); 76 m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43);
75 77
76 m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_commsManager.InterServiceInventoryService, 78 m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(),
77 m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); 79 m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);
78 80
79 m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); 81 m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
@@ -88,7 +90,7 @@ namespace OpenSim.Framework.Communications.Tests
88 TestHelper.InMethod(); 90 TestHelper.InMethod();
89 // We want to use our own LoginService for this test, one that 91 // We want to use our own LoginService for this test, one that
90 // doesn't require authentication. 92 // doesn't require authentication.
91 LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", m_commsManager.InterServiceInventoryService, 93 LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(),
92 m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector); 94 m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector);
93 95
94 Hashtable loginParams = new Hashtable(); 96 Hashtable loginParams = new Hashtable();
@@ -440,4 +442,123 @@ namespace OpenSim.Framework.Communications.Tests
440 #endregion 442 #endregion
441 } 443 }
442 } 444 }
445
446 class TestInventoryService : IInventoryService
447 {
448 public TestInventoryService()
449 {
450 }
451
452 /// <summary>
453 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
454 /// </summary>
455 /// <param name="userId"></param>
456 /// <returns></returns>
457 public bool CreateUserInventory(UUID userId)
458 {
459 return false;
460 }
461
462 /// <summary>
463 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
464 /// </summary>
465 /// <param name="userId"></param>
466 /// <returns></returns>
467 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
468 {
469 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
470 InventoryFolderBase folder = new InventoryFolderBase();
471 folder.ID = UUID.Random();
472 folder.Owner = userId;
473 folders.Add(folder);
474 return folders;
475 }
476
477 /// <summary>
478 /// Returns a list of all the active gestures in a user's inventory.
479 /// </summary>
480 /// <param name="userId">
481 /// The <see cref="UUID"/> of the user
482 /// </param>
483 /// <returns>
484 /// A flat list of the gesture items.
485 /// </returns>
486 public List<InventoryItemBase> GetActiveGestures(UUID userId)
487 {
488 return null;
489 }
490
491 public InventoryCollection GetUserInventory(UUID userID)
492 {
493 return null;
494 }
495
496 public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
497 {
498 }
499
500 public List<InventoryItemBase> GetFolderItems(UUID folderID)
501 {
502 return null;
503 }
504
505 public bool AddFolder(InventoryFolderBase folder)
506 {
507 return false;
508 }
509
510 public bool UpdateFolder(InventoryFolderBase folder)
511 {
512 return false;
513 }
514
515 public bool MoveFolder(InventoryFolderBase folder)
516 {
517 return false;
518 }
519
520 public bool PurgeFolder(InventoryFolderBase folder)
521 {
522 return false;
523 }
524
525 public bool AddItem(InventoryItemBase item)
526 {
527 return false;
528 }
529
530 public bool UpdateItem(InventoryItemBase item)
531 {
532 return false;
533 }
534
535 public bool DeleteItem(InventoryItemBase item)
536 {
537 return false;
538 }
539
540 public InventoryItemBase QueryItem(InventoryItemBase item)
541 {
542 return null;
543 }
544
545 public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
546 {
547 return null;
548 }
549
550 public bool HasInventoryForUser(UUID userID)
551 {
552 return false;
553 }
554
555 public InventoryFolderBase RequestRootFolder(UUID userID)
556 {
557 InventoryFolderBase root = new InventoryFolderBase();
558 root.ID = UUID.Random();
559 root.Owner = userID;
560 root.ParentID = UUID.Zero;
561 return root;
562 }
563 }
443} 564}