diff options
author | Melanie | 2011-10-11 21:28:23 +0100 |
---|---|---|
committer | Melanie | 2011-10-11 21:28:23 +0100 |
commit | 8fac7c065088d9861ba2ff772fde7f2e9c8d1003 (patch) | |
tree | 715c078c3a0ad1298b6b560cf31c2d445c22700a /OpenSim | |
parent | Merge commit 'c4efb97d49dec736151dfa3fa102efe6a5f6fbab' into bigmerge (diff) | |
parent | Correctly create a freshly created estate owner's default items and avatar en... (diff) | |
download | opensim-SC-8fac7c065088d9861ba2ff772fde7f2e9c8d1003.zip opensim-SC-8fac7c065088d9861ba2ff772fde7f2e9c8d1003.tar.gz opensim-SC-8fac7c065088d9861ba2ff772fde7f2e9c8d1003.tar.bz2 opensim-SC-8fac7c065088d9861ba2ff772fde7f2e9c8d1003.tar.xz |
Merge commit '522d6261f11ffaf8320c3f0775beb5d0608ce226' into bigmerge
Conflicts:
OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
Diffstat (limited to 'OpenSim')
4 files changed, 67 insertions, 93 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index dd0ea67..85870f0 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -41,11 +41,14 @@ using OpenSim.Framework.Servers; | |||
41 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Framework.Statistics; | 42 | using OpenSim.Framework.Statistics; |
43 | using OpenSim.Region.ClientStack; | 43 | using OpenSim.Region.ClientStack; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; | ||
44 | using OpenSim.Region.Framework; | 45 | using OpenSim.Region.Framework; |
45 | using OpenSim.Region.Framework.Interfaces; | 46 | using OpenSim.Region.Framework.Interfaces; |
46 | using OpenSim.Region.Framework.Scenes; | 47 | using OpenSim.Region.Framework.Scenes; |
47 | using OpenSim.Region.Physics.Manager; | 48 | using OpenSim.Region.Physics.Manager; |
48 | using OpenSim.Server.Base; | 49 | using OpenSim.Server.Base; |
50 | using OpenSim.Services.Interfaces; | ||
51 | using OpenSim.Services.UserAccountService; | ||
49 | 52 | ||
50 | namespace OpenSim | 53 | namespace OpenSim |
51 | { | 54 | { |
@@ -411,6 +414,53 @@ namespace OpenSim | |||
411 | scene.SnmpService.BootInfo("Loading prins", scene); | 414 | scene.SnmpService.BootInfo("Loading prins", scene); |
412 | } | 415 | } |
413 | 416 | ||
417 | // FIXME: Put me into a separate method! | ||
418 | while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | ||
419 | { | ||
420 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName); | ||
421 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
422 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
423 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
424 | |||
425 | UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last); | ||
426 | |||
427 | if (account == null) | ||
428 | { | ||
429 | m_log.DebugFormat("A {0}", scene.UserAccountService.GetType()); | ||
430 | |||
431 | // if (scene.UserAccountService is LocalUserAccountServicesConnector) | ||
432 | // { | ||
433 | // IUserAccountService innerUas | ||
434 | // = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService; | ||
435 | // | ||
436 | // m_log.DebugFormat("B {0}", innerUas.GetType()); | ||
437 | // | ||
438 | // if (innerUas is UserAccountService) | ||
439 | // { | ||
440 | |||
441 | if (scene.UserAccountService is UserAccountService) | ||
442 | { | ||
443 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
444 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
445 | |||
446 | // TODO: Where do we put m_regInfo.ScopeID? | ||
447 | account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email); | ||
448 | } | ||
449 | // } | ||
450 | } | ||
451 | |||
452 | if (account == null) | ||
453 | { | ||
454 | m_log.ErrorFormat( | ||
455 | "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
456 | } | ||
457 | else | ||
458 | { | ||
459 | regionInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
460 | regionInfo.EstateSettings.Save(); | ||
461 | } | ||
462 | } | ||
463 | |||
414 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 464 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
415 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 465 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
416 | 466 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 535a637..df31089 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -45,7 +45,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
45 | LogManager.GetLogger( | 45 | LogManager.GetLogger( |
46 | MethodBase.GetCurrentMethod().DeclaringType); | 46 | MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private IUserAccountService m_UserService; | 48 | /// <summary> |
49 | /// This is not on the IUserAccountService. It's only being used so that standalone scenes can punch through | ||
50 | /// to a local UserAccountService when setting up an estate manager. | ||
51 | /// </summary> | ||
52 | public IUserAccountService UserAccountService { get; private set; } | ||
53 | |||
49 | private UserAccountCache m_Cache; | 54 | private UserAccountCache m_Cache; |
50 | 55 | ||
51 | private bool m_Enabled = false; | 56 | private bool m_Enabled = false; |
@@ -86,9 +91,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
86 | } | 91 | } |
87 | 92 | ||
88 | Object[] args = new Object[] { source }; | 93 | Object[] args = new Object[] { source }; |
89 | m_UserService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args); | 94 | UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args); |
90 | 95 | ||
91 | if (m_UserService == null) | 96 | if (UserAccountService == null) |
92 | { | 97 | { |
93 | m_log.ErrorFormat( | 98 | m_log.ErrorFormat( |
94 | "[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll); | 99 | "[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll); |
@@ -119,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
119 | if (!m_Enabled) | 124 | if (!m_Enabled) |
120 | return; | 125 | return; |
121 | 126 | ||
122 | scene.RegisterModuleInterface<IUserAccountService>(m_UserService); | 127 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); |
123 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | 128 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); |
124 | } | 129 | } |
125 | 130 | ||
@@ -148,7 +153,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
148 | if (inCache) | 153 | if (inCache) |
149 | return account; | 154 | return account; |
150 | 155 | ||
151 | account = m_UserService.GetUserAccount(scopeID, userID); | 156 | account = UserAccountService.GetUserAccount(scopeID, userID); |
152 | m_Cache.Cache(userID, account); | 157 | m_Cache.Cache(userID, account); |
153 | 158 | ||
154 | return account; | 159 | return account; |
@@ -161,7 +166,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
161 | if (inCache) | 166 | if (inCache) |
162 | return account; | 167 | return account; |
163 | 168 | ||
164 | account = m_UserService.GetUserAccount(scopeID, firstName, lastName); | 169 | account = UserAccountService.GetUserAccount(scopeID, firstName, lastName); |
165 | if (account != null) | 170 | if (account != null) |
166 | m_Cache.Cache(account.PrincipalID, account); | 171 | m_Cache.Cache(account.PrincipalID, account); |
167 | 172 | ||
@@ -170,7 +175,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
170 | 175 | ||
171 | public UserAccount GetUserAccount(UUID scopeID, string Email) | 176 | public UserAccount GetUserAccount(UUID scopeID, string Email) |
172 | { | 177 | { |
173 | return m_UserService.GetUserAccount(scopeID, Email); | 178 | return UserAccountService.GetUserAccount(scopeID, Email); |
174 | } | 179 | } |
175 | 180 | ||
176 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | 181 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) |
@@ -180,17 +185,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
180 | 185 | ||
181 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 186 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
182 | { | 187 | { |
183 | return m_UserService.GetUserAccounts(scopeID, query); | 188 | return UserAccountService.GetUserAccounts(scopeID, query); |
184 | } | 189 | } |
185 | 190 | ||
186 | // Update all updatable fields | 191 | // Update all updatable fields |
187 | // | 192 | // |
188 | public bool StoreUserAccount(UserAccount data) | 193 | public bool StoreUserAccount(UserAccount data) |
189 | { | 194 | { |
190 | return m_UserService.StoreUserAccount(data); | 195 | return UserAccountService.StoreUserAccount(data); |
191 | } | 196 | } |
192 | 197 | ||
193 | #endregion | 198 | #endregion |
194 | |||
195 | } | 199 | } |
196 | } | 200 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 74ae47a..7897564 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1198,88 +1198,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1198 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1198 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
1199 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); | 1199 | m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); |
1200 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); | 1200 | m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); |
1201 | |||
1202 | // Shoving this in here for now, because we have the needed | ||
1203 | // interfaces at this point | ||
1204 | // | ||
1205 | // TODO: Find a better place for this | ||
1206 | // | ||
1207 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | ||
1208 | { | ||
1209 | MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); | ||
1210 | List<char> excluded = new List<char>(new char[1]{' '}); | ||
1211 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); | ||
1212 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
1213 | |||
1214 | UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); | ||
1215 | |||
1216 | if (account == null) | ||
1217 | { | ||
1218 | // Create a new account | ||
1219 | account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); | ||
1220 | if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) | ||
1221 | { | ||
1222 | account.ServiceURLs = new Dictionary<string, object>(); | ||
1223 | account.ServiceURLs["HomeURI"] = string.Empty; | ||
1224 | account.ServiceURLs["GatekeeperURI"] = string.Empty; | ||
1225 | account.ServiceURLs["InventoryServerURI"] = string.Empty; | ||
1226 | account.ServiceURLs["AssetServerURI"] = string.Empty; | ||
1227 | } | ||
1228 | |||
1229 | if (UserAccountService.StoreUserAccount(account)) | ||
1230 | { | ||
1231 | string password = MainConsole.Instance.PasswdPrompt("Password"); | ||
1232 | string email = MainConsole.Instance.CmdPrompt("Email", ""); | ||
1233 | |||
1234 | account.Email = email; | ||
1235 | UserAccountService.StoreUserAccount(account); | ||
1236 | |||
1237 | bool success = false; | ||
1238 | success = AuthenticationService.SetPassword(account.PrincipalID, password); | ||
1239 | if (!success) | ||
1240 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.", | ||
1241 | first, last); | ||
1242 | |||
1243 | GridRegion home = null; | ||
1244 | if (GridService != null) | ||
1245 | { | ||
1246 | List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero); | ||
1247 | if (defaultRegions != null && defaultRegions.Count >= 1) | ||
1248 | home = defaultRegions[0]; | ||
1249 | |||
1250 | if (GridUserService != null && home != null) | ||
1251 | GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | ||
1252 | else | ||
1253 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.", | ||
1254 | first, last); | ||
1255 | |||
1256 | } | ||
1257 | else | ||
1258 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.", | ||
1259 | first, last); | ||
1260 | |||
1261 | if (InventoryService != null) | ||
1262 | success = InventoryService.CreateUserInventory(account.PrincipalID); | ||
1263 | if (!success) | ||
1264 | m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.", | ||
1265 | first, last); | ||
1266 | |||
1267 | |||
1268 | |||
1269 | m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last); | ||
1270 | |||
1271 | m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
1272 | m_regInfo.EstateSettings.Save(); | ||
1273 | } | ||
1274 | else | ||
1275 | m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first."); | ||
1276 | } | ||
1277 | else | ||
1278 | { | ||
1279 | m_regInfo.EstateSettings.EstateOwner = account.PrincipalID; | ||
1280 | m_regInfo.EstateSettings.Save(); | ||
1281 | } | ||
1282 | } | ||
1283 | } | 1201 | } |
1284 | 1202 | ||
1285 | #endregion | 1203 | #endregion |
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 5f388a4..961698c 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs | |||
@@ -475,7 +475,7 @@ namespace OpenSim.Services.UserAccountService | |||
475 | /// <param name="lastName"></param> | 475 | /// <param name="lastName"></param> |
476 | /// <param name="password"></param> | 476 | /// <param name="password"></param> |
477 | /// <param name="email"></param> | 477 | /// <param name="email"></param> |
478 | private void CreateUser(string firstName, string lastName, string password, string email) | 478 | public UserAccount CreateUser(string firstName, string lastName, string password, string email) |
479 | { | 479 | { |
480 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); | 480 | UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); |
481 | if (null == account) | 481 | if (null == account) |
@@ -543,6 +543,8 @@ namespace OpenSim.Services.UserAccountService | |||
543 | { | 543 | { |
544 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); | 544 | m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); |
545 | } | 545 | } |
546 | |||
547 | return account; | ||
546 | } | 548 | } |
547 | 549 | ||
548 | private void CreateDefaultAppearanceEntries(UUID principalID) | 550 | private void CreateDefaultAppearanceEntries(UUID principalID) |