From 0862627b341641ec0223bb4191dfee8d85724c9e Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 28 Nov 2008 15:34:30 +0000 Subject: * refactor: move CreateUser into UserServiceAdmin --- OpenSim/Region/Application/OpenSim.cs | 4 ++-- OpenSim/Region/Application/OpenSimBase.cs | 8 +------- .../Communications/Local/LocalLoginService.cs | 11 +++-------- .../Communications/Local/LocalUserServices.cs | 23 ++++------------------ .../Modules/InterGrid/OpenGridProtocolModule.cs | 6 ++++-- .../Environment/Scenes/Tests/SceneObjectTests.cs | 3 ++- .../Scenes/Tests/TestCommunicationsManager.cs | 8 ++++---- 7 files changed, 20 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index d44eedf..d29d0e4 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -535,7 +535,7 @@ namespace OpenSim } else { - m_console.Notice("Create user is not available in grid mode, use the user-server."); + m_console.Notice("Create user is not available in grid mode, use the user server."); } break; } @@ -800,7 +800,7 @@ namespace OpenSim if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName)) { - CreateUser(firstName, lastName, password, email, regX, regY); + m_commsManager.UserServiceAdmin.AddUser(firstName, lastName, password, email, regX, regY); } else { diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index fb620c3..7ccb3d4 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -298,11 +298,6 @@ namespace OpenSim m_assetCache = new AssetCache(assetServer); } - public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, string email, uint regX, uint regY) - { - return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, email, regX, regY); - } - public void ProcessLogin(bool LoginEnabled) { if (LoginEnabled) @@ -314,8 +309,7 @@ namespace OpenSim { m_log.Info("[Login] Login are now disabled "); m_commsManager.GridService.RegionLoginsEnabled = false; - } - + } } /// diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index 81cbbb4..50a8e16 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -94,16 +94,11 @@ namespace OpenSim.Region.Communications.Local //no current user account so make one m_log.Info("[LOGIN]: No user account found so creating a new one."); - m_userManager.AddUserProfile(firstname, lastname, "test", "", defaultHomeX, defaultHomeY); + m_userManager.AddUser(firstname, lastname, "test", "", defaultHomeX, defaultHomeY); - profile = m_userManager.GetUserProfile(firstname, lastname); - if (profile != null) - { - m_interServiceInventoryService.CreateNewUserInventory(profile.ID); - } - - return profile; + return m_userManager.GetUserProfile(firstname, lastname); } + return null; } diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 8649d61..e0c9c83 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -34,13 +34,11 @@ namespace OpenSim.Region.Communications.Local { public class LocalUserServices : UserManagerBase { - // private readonly NetworkServersInfo m_serversInfo; private readonly uint m_defaultHomeX; private readonly uint m_defaultHomeY; - private IInterServiceInventoryServices m_interServiceInventoryService; /// - /// + /// User services used when OpenSim is running in standalone mode. /// /// /// @@ -49,13 +47,12 @@ namespace OpenSim.Region.Communications.Local /// Can be null if stats collection is not required. public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, IInterServiceInventoryServices interServiceInventoryService) + : base(interServiceInventoryService) { // m_serversInfo = serversInfo; m_defaultHomeX = defaultHomeLocX; m_defaultHomeY = defaultHomeLocY; - - m_interServiceInventoryService = interServiceInventoryService; } public override UserProfileData SetupMasterUser(string firstName, string lastName) @@ -72,20 +69,8 @@ namespace OpenSim.Region.Communications.Local } Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); - AddUserProfile(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY); - - profile = GetUserProfile(firstName, lastName); - - if (profile == null) - { - Console.WriteLine("[LOCAL USER SERVICES]: Unknown Master User after creation attempt. No clue what to do here."); - } - else - { - m_interServiceInventoryService.CreateNewUserInventory(profile.ID); - } - - return profile; + AddUser(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY); + return GetUserProfile(firstName, lastName); } public override UserProfileData SetupMasterUser(UUID uuid) diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index e3e69b0..a855617 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -530,7 +530,10 @@ namespace OpenSim.Region.Environment.Modules.InterGrid // get seed capagentData.firstname = FirstName;agentData.lastname = LastName; if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode) { - homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), "", homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); + homeScene.CommsManager.UserServiceAdmin.AddUser( + agentData.firstname, agentData.lastname, CreateRandomStr(7), "", + homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); + UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID); if (userProfile2 != null) { @@ -539,7 +542,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid userProfile.FirstLifeAboutText = "OGP USER"; homeScene.CommsManager.UserService.UpdateUserProfile(userProfile); } - } // Stick our data in the cache so the region will know something about us diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 7f6fa3c..6577fe3 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -105,7 +105,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests ((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); Assert.That( - scene.CommsManager.AddUser("Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), + scene.CommsManager.UserServiceAdmin.AddUser( + "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), Is.EqualTo(agentId)); IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs b/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs index 07cd429..b9804d9 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs @@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Tests public TestCommunicationsManager() : base(null, null, null, false, null) { - LocalUserServices lus = new LocalUserServices(null, 991, 992, null); - m_userService = lus; - m_userServiceAdmin = lus; - LocalInventoryService lis = new LocalInventoryService(); m_interServiceInventoryService = lis; AddInventoryService(lis); + + LocalUserServices lus = new LocalUserServices(null, 991, 992, lis); + m_userService = lus; + m_userServiceAdmin = lus; } } } -- cgit v1.1