aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs12
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs63
-rw-r--r--OpenSim/Framework/Communications/IUserServiceAdmin.cs30
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs1
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs68
-rw-r--r--OpenSim/Grid/MessagingServer/UserManager.cs11
-rw-r--r--OpenSim/Grid/UserServer/Main.cs64
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs6
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs8
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs8
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs11
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs23
-rw-r--r--OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/TestCommunicationsManager.cs8
16 files changed, 135 insertions, 191 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index db99450..7f7689d 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -474,7 +474,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
474 { 474 {
475 m_log.InfoFormat("master avatar does not exist, creating it"); 475 m_log.InfoFormat("master avatar does not exist, creating it");
476 // ...or create new user 476 // ...or create new user
477 userID = m_app.CreateUser(masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); 477 userID = m_app.CommunicationsManager.UserServiceAdmin.AddUser(
478 masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY);
479
478 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 480 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
479 masterFirst, masterLast)); 481 masterFirst, masterLast));
480 } 482 }
@@ -668,7 +670,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
668 if (null != userProfile) 670 if (null != userProfile)
669 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 671 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
670 672
671 UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY); 673 UUID userID
674 = m_app.CommunicationsManager.UserServiceAdmin.AddUser(
675 firstname, lastname, passwd, email, regX, regY);
672 676
673 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 677 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
674 firstname, lastname)); 678 firstname, lastname));
@@ -764,7 +768,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
764 if (null != userProfile) 768 if (null != userProfile)
765 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); 769 throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
766 770
767 UUID userID = m_app.CreateUser(firstname, lastname, passwd, email, regX, regY); 771 UUID userID
772 = m_app.CommunicationsManager.UserServiceAdmin.AddUser(
773 firstname, lastname, passwd, email, regX, regY);
768 774
769 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", 775 if (userID == UUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
770 firstname, lastname)); 776 firstname, lastname));
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index bcf9bed..a5ead3f 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -106,8 +106,12 @@ namespace OpenSim.Framework.Communications
106 protected NetworkServersInfo m_networkServersInfo; 106 protected NetworkServersInfo m_networkServersInfo;
107 107
108 /// <summary> 108 /// <summary>
109 /// Interface to administrative user service calls. 109 /// Interface to user service for administrating users.
110 /// </summary> 110 /// </summary>
111 public IUserServiceAdmin UserServiceAdmin
112 {
113 get { return m_userServiceAdmin; }
114 }
111 protected IUserServiceAdmin m_userServiceAdmin; 115 protected IUserServiceAdmin m_userServiceAdmin;
112 116
113 public BaseHttpServer HttpServer 117 public BaseHttpServer HttpServer
@@ -247,63 +251,6 @@ namespace OpenSim.Framework.Communications
247 } 251 }
248 252
249 #endregion 253 #endregion
250
251 /// <summary>
252 /// Persistently adds a user to OpenSim.
253 /// </summary>
254 /// <param name="firstName"></param>
255 /// <param name="lastName"></param>
256 /// <param name="password"></param>
257 /// <param name="email"></param>
258 /// <param name="regX"></param>
259 /// <param name="regY"></param>
260 /// <returns>The UUID of the added user. Returns UUID.Zero if the add was unsuccessful</returns>
261 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
262 {
263 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
264
265 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY);
266 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
267 if (userProf == null)
268 {
269 return UUID.Zero;
270 }
271 else
272 {
273 InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
274 m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
275 return userProf.ID;
276 }
277 }
278
279 /// <summary>
280 /// Adds the user.
281 /// </summary>
282 /// <param name="firstName">The first name.</param>
283 /// <param name="lastName">The last name.</param>
284 /// <param name="password">The password.</param>
285 /// <param name="email">The email.</param>
286 /// <param name="regX">The reg X.</param>
287 /// <param name="regY">The reg Y.</param>
288 /// <param name="SetUUID">The set UUID.</param>
289 /// <returns></returns>
290 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
291 {
292 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
293
294 m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, email, regX, regY, SetUUID);
295 UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
296 if (userProf == null)
297 {
298 return UUID.Zero;
299 }
300 else
301 {
302 InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
303 m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
304 return userProf.ID;
305 }
306 }
307 254
308 /// <summary> 255 /// <summary>
309 /// Reset a user password 256 /// Reset a user password
diff --git a/OpenSim/Framework/Communications/IUserServiceAdmin.cs b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
index a120add..b1f974b 100644
--- a/OpenSim/Framework/Communications/IUserServiceAdmin.cs
+++ b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
@@ -32,29 +32,29 @@ namespace OpenSim.Framework.Communications
32 public interface IUserServiceAdmin 32 public interface IUserServiceAdmin
33 { 33 {
34 /// <summary> 34 /// <summary>
35 /// Add a new user profile 35 /// Add a new user
36 /// </summary> 36 /// </summary>
37 /// <param name="firstName">The first name.</param> 37 /// <param name="firstName">The first name</param>
38 /// <param name="lastName">The last name.</param> 38 /// <param name="lastName">The last name</param>
39 /// <param name="pass">password of avatar</param> 39 /// <param name="pass">password of avatar</param>
40 /// <param name="email">email of user</param> 40 /// <param name="email">email of user</param>
41 /// <param name="regX">region X.</param> 41 /// <param name="regX">region X</param>
42 /// <param name="regY">region Y.</param> 42 /// <param name="regY">region Y</param>
43 /// <returns></returns> 43 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
44 UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY); 44 UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY);
45 45
46 /// <summary> 46 /// <summary>
47 /// Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances! 47 /// Add a new user with a specified UUID. SHOULD ONLY BE USED in very special circumstances from modules!
48 /// </summary> 48 /// </summary>
49 /// <param name="firstName">The first name.</param> 49 /// <param name="firstName">The first name</param>
50 /// <param name="lastName">The last name.</param> 50 /// <param name="lastName">The last name</param>
51 /// <param name="pass">password of avatar</param> 51 /// <param name="pass">password of avatar</param>
52 /// <param name="email">email of user</param> 52 /// <param name="email">email of user</param>
53 /// <param name="regX">region X.</param> 53 /// <param name="regX">region X</param>
54 /// <param name="regY">region Y.</param> 54 /// <param name="regY">region Y</param>
55 /// <param name="setUUID">The set UUID.</param> 55 /// <param name="setUUID">The set UUID</param>
56 /// <returns></returns> 56 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
57 UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID); 57 UUID AddUser(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID setUUID);
58 58
59 /// <summary> 59 /// <summary>
60 /// Reset a user password 60 /// Reset a user password
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 777e15b..7a44420 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -82,7 +82,6 @@ namespace OpenSim.Framework.Communications
82 get { return "default"; } 82 get { return "default"; }
83 } 83 }
84 84
85 // See IInventoryServices
86 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 85 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
87 { 86 {
88// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); 87// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId);
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index a5ca654..3946ea3 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -52,6 +52,17 @@ namespace OpenSim.Framework.Communications
52 /// List of plugins to search for user data 52 /// List of plugins to search for user data
53 /// </value> 53 /// </value>
54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); 54 private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>();
55
56 private IInterServiceInventoryServices m_interServiceInventoryService;
57
58 /// <summary>
59 /// Constructor
60 /// </summary>
61 /// <param name="interServiceInventoryService"></param>
62 public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService)
63 {
64 m_interServiceInventoryService = interServiceInventoryService;
65 }
55 66
56 /// <summary> 67 /// <summary>
57 /// Add a new user data plugin - plugins will be requested in the order they were added. 68 /// Add a new user data plugin - plugins will be requested in the order they were added.
@@ -80,7 +91,7 @@ namespace OpenSim.Framework.Communications
80 _plugins.AddRange(loader.Plugins); 91 _plugins.AddRange(loader.Plugins);
81 } 92 }
82 93
83 #region Get UserProfile 94 #region Get UserProfile
84 95
85 // see IUserService 96 // see IUserService
86 public UserProfileData GetUserProfile(string fname, string lname) 97 public UserProfileData GetUserProfile(string fname, string lname)
@@ -586,39 +597,42 @@ namespace OpenSim.Framework.Communications
586 #endregion 597 #endregion
587 598
588 /// <summary> 599 /// <summary>
589 /// Add a new user profile 600 /// Add a new user
590 /// </summary> 601 /// </summary>
591 /// <param name="firstName">first name.</param> 602 /// <param name="firstName">first name</param>
592 /// <param name="lastName">last name.</param> 603 /// <param name="lastName">last name</param>
593 /// <param name="pass">password</param> 604 /// <param name="password">password</param>
594 /// <param name="email">email.</param> 605 /// <param name="email">email</param>
595 /// <param name="regX">location X.</param> 606 /// <param name="regX">location X</param>
596 /// <param name="regY">location Y.</param> 607 /// <param name="regY">location Y</param>
597 /// <returns></returns> 608 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
598 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY) 609 public UUID AddUser(string firstName, string lastName, string password, string email, uint regX, uint regY)
599 { 610 {
600 return AddUserProfile(firstName, lastName, pass, email, regX, regY, UUID.Random()); 611 return AddUser(firstName, lastName, password, email, regX, regY, UUID.Random());
601 } 612 }
602 613
603 /// <summary> 614 /// <summary>
604 /// Adds the user profile. 615 /// Add a new user
605 /// </summary> 616 /// </summary>
606 /// <param name="firstName">first name.</param> 617 /// <param name="firstName">first name</param>
607 /// <param name="lastName">last name.</param> 618 /// <param name="lastName">last name</param>
608 /// <param name="pass">password</param> 619 /// <param name="password">password</param>
609 /// <param name="email">email.</param> 620 /// <param name="email">email</param>
610 /// <param name="regX">location X.</param> 621 /// <param name="regX">location X</param>
611 /// <param name="regY">location Y.</param> 622 /// <param name="regY">location Y</param>
612 /// <param name="SetUUID">UUID of avatar.</param> 623 /// <param name="SetUUID">UUID of avatar.</param>
613 /// <returns></returns> 624 /// <returns>The UUID of the created user profile. On failure, returns UUID.Zero</returns>
614 public UUID AddUserProfile(string firstName, string lastName, string pass, string email, uint regX, uint regY, UUID SetUUID) 625 public UUID AddUser(
626 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
615 { 627 {
628 string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
629
616 UserProfileData user = new UserProfileData(); 630 UserProfileData user = new UserProfileData();
617 user.HomeLocation = new Vector3(128, 128, 100); 631 user.HomeLocation = new Vector3(128, 128, 100);
618 user.ID = SetUUID; 632 user.ID = SetUUID;
619 user.FirstName = firstName; 633 user.FirstName = firstName;
620 user.SurName = lastName; 634 user.SurName = lastName;
621 user.PasswordHash = pass; 635 user.PasswordHash = md5PasswdHash;
622 user.PasswordSalt = String.Empty; 636 user.PasswordSalt = String.Empty;
623 user.Created = Util.UnixTimeSinceEpoch(); 637 user.Created = Util.UnixTimeSinceEpoch();
624 user.HomeLookAt = new Vector3(100, 100, 100); 638 user.HomeLookAt = new Vector3(100, 100, 100);
@@ -638,7 +652,17 @@ namespace OpenSim.Framework.Communications
638 } 652 }
639 } 653 }
640 654
641 return user.ID; 655 UserProfileData userProf = GetUserProfile(firstName, lastName);
656 if (userProf == null)
657 {
658 return UUID.Zero;
659 }
660 else
661 {
662 m_interServiceInventoryService.CreateNewUserInventory(userProf.ID);
663
664 return userProf.ID;
665 }
642 } 666 }
643 667
644 /// <summary> 668 /// <summary>
diff --git a/OpenSim/Grid/MessagingServer/UserManager.cs b/OpenSim/Grid/MessagingServer/UserManager.cs
index 6fa5113..fc8f703 100644
--- a/OpenSim/Grid/MessagingServer/UserManager.cs
+++ b/OpenSim/Grid/MessagingServer/UserManager.cs
@@ -41,6 +41,15 @@ namespace OpenSim.Grid.MessagingServer
41{ 41{
42 class UserManager : UserManagerBase 42 class UserManager : UserManagerBase
43 { 43 {
44 /// <summary>
45 /// Constructor.
46 /// </summary>
47 /// Passing null to parent because we never use any function that requires an interservice inventory call.
48 public UserManager()
49 : base(null)
50 {
51 }
52
44 public UserAgentData GetUserAgentData(UUID AgentID) 53 public UserAgentData GetUserAgentData(UUID AgentID)
45 { 54 {
46 UserProfileData userProfile = GetUserProfile(AgentID); 55 UserProfileData userProfile = GetUserProfile(AgentID);
@@ -53,8 +62,6 @@ namespace OpenSim.Grid.MessagingServer
53 return null; 62 return null;
54 } 63 }
55 64
56
57
58 public override UserProfileData SetupMasterUser(string firstName, string lastName) 65 public override UserProfileData SetupMasterUser(string firstName, string lastName)
59 { 66 {
60 //throw new Exception("The method or operation is not implemented."); 67 //throw new Exception("The method or operation is not implemented.");
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 9c8fe23..cab5860 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -56,7 +56,6 @@ namespace OpenSim.Grid.UserServer
56 public UserLoginService m_loginService; 56 public UserLoginService m_loginService;
57 public GridInfoService m_gridInfoService; 57 public GridInfoService m_gridInfoService;
58 public MessageServersConnector m_messagesService; 58 public MessageServersConnector m_messagesService;
59 protected IInterServiceInventoryServices m_interServiceInventoryService;
60 59
61 private UUID m_lastCreatedUser = UUID.Random(); 60 private UUID m_lastCreatedUser = UUID.Random();
62 61
@@ -94,17 +93,16 @@ namespace OpenSim.Grid.UserServer
94 93
95 m_stats = StatsManager.StartCollectingUserStats(); 94 m_stats = StatsManager.StartCollectingUserStats();
96 95
97 m_log.Info("[REGION]: Establishing data connection"); 96 m_log.Info("[STARTUP]: Establishing data connection");
98 97
99 StartupUserManager(); 98 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
100 99
100 StartupUserManager(inventoryService);
101 m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); 101 m_userManager.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect);
102 102
103 m_gridInfoService = new GridInfoService(); 103 m_gridInfoService = new GridInfoService();
104 104
105 m_interServiceInventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); 105 StartupLoginService(inventoryService);
106
107 StartupLoginService();
108 106
109 m_messagesService = new MessageServersConnector(); 107 m_messagesService = new MessageServersConnector();
110 108
@@ -116,22 +114,30 @@ namespace OpenSim.Grid.UserServer
116 m_messagesService.OnRegionStartup += HandleRegionStartup; 114 m_messagesService.OnRegionStartup += HandleRegionStartup;
117 m_messagesService.OnRegionShutdown += HandleRegionShutdown; 115 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
118 116
119 m_log.Info("[REGION]: Starting HTTP process"); 117 m_log.Info("[STARTUP]: Starting HTTP process");
120 118
121 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 119 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
122 AddHttpHandlers(); 120 AddHttpHandlers();
123 m_httpServer.Start(); 121 m_httpServer.Start();
124 } 122 }
125 123
126 protected virtual void StartupUserManager() 124 /// <summary>
125 /// Start up the user manager
126 /// </summary>
127 /// <param name="inventoryService"></param>
128 protected virtual void StartupUserManager(IInterServiceInventoryServices inventoryService)
127 { 129 {
128 m_userManager = new UserManager(); 130 m_userManager = new UserManager(new OGS1InterServiceInventoryService(Cfg.InventoryUrl));
129 } 131 }
130 132
131 protected virtual void StartupLoginService() 133 /// <summary>
134 /// Start up the login service
135 /// </summary>
136 /// <param name="inventoryService"></param>
137 protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
132 { 138 {
133 m_loginService = new UserLoginService( 139 m_loginService = new UserLoginService(
134 m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); 140 m_userManager, inventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
135 } 141 }
136 142
137 protected virtual void AddHttpHandlers() 143 protected virtual void AddHttpHandlers()
@@ -256,39 +262,7 @@ namespace OpenSim.Grid.UserServer
256 262
257 if (null == m_userManager.GetUserProfile(firstName, lastName)) 263 if (null == m_userManager.GetUserProfile(firstName, lastName))
258 { 264 {
259 password = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); 265 m_lastCreatedUser = m_userManager.AddUser(firstName, lastName, password, email, regX, regY);
260
261 UUID userID = new UUID();
262
263 try
264 {
265 userID = m_userManager.AddUserProfile(firstName, lastName, password, email, regX, regY);
266 }
267 catch (Exception ex)
268 {
269 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
270 }
271
272 try
273 {
274 if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
275 {
276 throw new Exception(
277 String.Format("The inventory creation request for user {0} did not succeed."
278 + " Please contact your inventory service provider for more information.", userID));
279 }
280 }
281 catch (WebException)
282 {
283 m_log.ErrorFormat("[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
284 Cfg.InventoryUrl + "CreateInventory/", userID);
285 }
286 catch (Exception e)
287 {
288 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
289 }
290
291 m_lastCreatedUser = userID;
292 } 266 }
293 else 267 else
294 { 268 {
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 82d5af5..2308910 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -44,6 +44,9 @@ namespace OpenSim.Grid.UserServer
44 ulong regionhandle, float positionX, float positionY, float positionZ, 44 ulong regionhandle, float positionX, float positionY, float positionZ,
45 string firstname, string lastname); 45 string firstname, string lastname);
46 46
47 /// <summary>
48 /// Login service used in grid mode.
49 /// </summary>
47 public class UserLoginService : LoginService 50 public class UserLoginService : LoginService
48 { 51 {
49 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -65,17 +68,16 @@ namespace OpenSim.Grid.UserServer
65 m_config = config; 68 m_config = config;
66 m_inventoryService = inventoryService; 69 m_inventoryService = inventoryService;
67 } 70 }
71
68 public void setloginlevel(int level) 72 public void setloginlevel(int level)
69 { 73 {
70 m_minLoginLevel = level; 74 m_minLoginLevel = level;
71 m_log.InfoFormat("[GRID] Login Level set to {0} ", level); 75 m_log.InfoFormat("[GRID] Login Level set to {0} ", level);
72
73 } 76 }
74 public void setwelcometext(string text) 77 public void setwelcometext(string text)
75 { 78 {
76 m_welcomeMessage = text; 79 m_welcomeMessage = text;
77 m_log.InfoFormat("[GRID] Login text set to {0} ", text); 80 m_log.InfoFormat("[GRID] Login text set to {0} ", text);
78
79 } 81 }
80 82
81 public override void LogOffUser(UserProfileData theUser, string message) 83 public override void LogOffUser(UserProfileData theUser, string message)
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 76f83b7..377ff3a 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -46,6 +46,14 @@ namespace OpenSim.Grid.UserServer
46 46
47 public event logOffUser OnLogOffUser; 47 public event logOffUser OnLogOffUser;
48 private logOffUser handlerLogOffUser; 48 private logOffUser handlerLogOffUser;
49
50 /// <summary>
51 /// Constructor
52 /// </summary>
53 /// <param name="interServiceInventoryService"></param>
54 public UserManager(IInterServiceInventoryServices interServiceInventoryService)
55 : base(interServiceInventoryService)
56 {}
49 57
50 /// <summary> 58 /// <summary>
51 /// Deletes an active agent session 59 /// Deletes an active agent session
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
535 } 535 }
536 else 536 else
537 { 537 {
538 m_console.Notice("Create user is not available in grid mode, use the user-server."); 538 m_console.Notice("Create user is not available in grid mode, use the user server.");
539 } 539 }
540 break; 540 break;
541 } 541 }
@@ -800,7 +800,7 @@ namespace OpenSim
800 800
801 if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName)) 801 if (null == m_commsManager.UserService.GetUserProfile(firstName, lastName))
802 { 802 {
803 CreateUser(firstName, lastName, password, email, regX, regY); 803 m_commsManager.UserServiceAdmin.AddUser(firstName, lastName, password, email, regX, regY);
804 } 804 }
805 else 805 else
806 { 806 {
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
298 m_assetCache = new AssetCache(assetServer); 298 m_assetCache = new AssetCache(assetServer);
299 } 299 }
300 300
301 public UUID CreateUser(string tempfirstname, string templastname, string tempPasswd, string email, uint regX, uint regY)
302 {
303 return m_commsManager.AddUser(tempfirstname, templastname, tempPasswd, email, regX, regY);
304 }
305
306 public void ProcessLogin(bool LoginEnabled) 301 public void ProcessLogin(bool LoginEnabled)
307 { 302 {
308 if (LoginEnabled) 303 if (LoginEnabled)
@@ -314,8 +309,7 @@ namespace OpenSim
314 { 309 {
315 m_log.Info("[Login] Login are now disabled "); 310 m_log.Info("[Login] Login are now disabled ");
316 m_commsManager.GridService.RegionLoginsEnabled = false; 311 m_commsManager.GridService.RegionLoginsEnabled = false;
317 } 312 }
318
319 } 313 }
320 314
321 /// <summary> 315 /// <summary>
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
94 //no current user account so make one 94 //no current user account so make one
95 m_log.Info("[LOGIN]: No user account found so creating a new one."); 95 m_log.Info("[LOGIN]: No user account found so creating a new one.");
96 96
97 m_userManager.AddUserProfile(firstname, lastname, "test", "", defaultHomeX, defaultHomeY); 97 m_userManager.AddUser(firstname, lastname, "test", "", defaultHomeX, defaultHomeY);
98 98
99 profile = m_userManager.GetUserProfile(firstname, lastname); 99 return m_userManager.GetUserProfile(firstname, lastname);
100 if (profile != null)
101 {
102 m_interServiceInventoryService.CreateNewUserInventory(profile.ID);
103 }
104
105 return profile;
106 } 100 }
101
107 return null; 102 return null;
108 } 103 }
109 104
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
34{ 34{
35 public class LocalUserServices : UserManagerBase 35 public class LocalUserServices : UserManagerBase
36 { 36 {
37 // private readonly NetworkServersInfo m_serversInfo;
38 private readonly uint m_defaultHomeX; 37 private readonly uint m_defaultHomeX;
39 private readonly uint m_defaultHomeY; 38 private readonly uint m_defaultHomeY;
40 private IInterServiceInventoryServices m_interServiceInventoryService;
41 39
42 /// <summary> 40 /// <summary>
43 /// 41 /// User services used when OpenSim is running in standalone mode.
44 /// </summary> 42 /// </summary>
45 /// <param name="serversInfo"></param> 43 /// <param name="serversInfo"></param>
46 /// <param name="defaultHomeLocX"></param> 44 /// <param name="defaultHomeLocX"></param>
@@ -49,13 +47,12 @@ namespace OpenSim.Region.Communications.Local
49 /// <param name="statsCollector">Can be null if stats collection is not required.</param> 47 /// <param name="statsCollector">Can be null if stats collection is not required.</param>
50 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, 48 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
51 IInterServiceInventoryServices interServiceInventoryService) 49 IInterServiceInventoryServices interServiceInventoryService)
50 : base(interServiceInventoryService)
52 { 51 {
53 // m_serversInfo = serversInfo; 52 // m_serversInfo = serversInfo;
54 53
55 m_defaultHomeX = defaultHomeLocX; 54 m_defaultHomeX = defaultHomeLocX;
56 m_defaultHomeY = defaultHomeLocY; 55 m_defaultHomeY = defaultHomeLocY;
57
58 m_interServiceInventoryService = interServiceInventoryService;
59 } 56 }
60 57
61 public override UserProfileData SetupMasterUser(string firstName, string lastName) 58 public override UserProfileData SetupMasterUser(string firstName, string lastName)
@@ -72,20 +69,8 @@ namespace OpenSim.Region.Communications.Local
72 } 69 }
73 70
74 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account"); 71 Console.WriteLine("Unknown Master User. Sandbox Mode: Creating Account");
75 AddUserProfile(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY); 72 AddUser(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY);
76 73 return GetUserProfile(firstName, lastName);
77 profile = GetUserProfile(firstName, lastName);
78
79 if (profile == null)
80 {
81 Console.WriteLine("[LOCAL USER SERVICES]: Unknown Master User after creation attempt. No clue what to do here.");
82 }
83 else
84 {
85 m_interServiceInventoryService.CreateNewUserInventory(profile.ID);
86 }
87
88 return profile;
89 } 74 }
90 75
91 public override UserProfileData SetupMasterUser(UUID uuid) 76 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
530 // get seed capagentData.firstname = FirstName;agentData.lastname = LastName; 530 // get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
531 if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode) 531 if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
532 { 532 {
533 homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), "", homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); 533 homeScene.CommsManager.UserServiceAdmin.AddUser(
534 agentData.firstname, agentData.lastname, CreateRandomStr(7), "",
535 homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
536
534 UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID); 537 UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
535 if (userProfile2 != null) 538 if (userProfile2 != null)
536 { 539 {
@@ -539,7 +542,6 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
539 userProfile.FirstLifeAboutText = "OGP USER"; 542 userProfile.FirstLifeAboutText = "OGP USER";
540 homeScene.CommsManager.UserService.UpdateUserProfile(userProfile); 543 homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
541 } 544 }
542
543 } 545 }
544 546
545 // Stick our data in the cache so the region will know something about us 547 // 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
105 ((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); 105 ((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
106 106
107 Assert.That( 107 Assert.That(
108 scene.CommsManager.AddUser("Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), 108 scene.CommsManager.UserServiceAdmin.AddUser(
109 "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
109 Is.EqualTo(agentId)); 110 Is.EqualTo(agentId));
110 111
111 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); 112 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
38 public TestCommunicationsManager() 38 public TestCommunicationsManager()
39 : base(null, null, null, false, null) 39 : base(null, null, null, false, null)
40 { 40 {
41 LocalUserServices lus = new LocalUserServices(null, 991, 992, null);
42 m_userService = lus;
43 m_userServiceAdmin = lus;
44
45 LocalInventoryService lis = new LocalInventoryService(); 41 LocalInventoryService lis = new LocalInventoryService();
46 m_interServiceInventoryService = lis; 42 m_interServiceInventoryService = lis;
47 AddInventoryService(lis); 43 AddInventoryService(lis);
44
45 LocalUserServices lus = new LocalUserServices(null, 991, 992, lis);
46 m_userService = lus;
47 m_userServiceAdmin = lus;
48 } 48 }
49 } 49 }
50} 50}