diff options
author | Justin Clarke Casey | 2008-11-28 15:34:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-28 15:34:30 +0000 |
commit | 0862627b341641ec0223bb4191dfee8d85724c9e (patch) | |
tree | ef1815b067c345aa92a81375f12137a3e47876f3 /OpenSim/Grid | |
parent | * Changed name of auth function to better reflect actual use (diff) | |
download | opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.zip opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.gz opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.bz2 opensim-SC_OLD-0862627b341641ec0223bb4191dfee8d85724c9e.tar.xz |
* refactor: move CreateUser into UserServiceAdmin
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r-- | OpenSim/Grid/MessagingServer/UserManager.cs | 11 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 64 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 6 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserManager.cs | 8 |
4 files changed, 40 insertions, 49 deletions
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 |