aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs50
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs82
3 files changed, 65 insertions, 93 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 92e8ed1..3060169 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -41,11 +41,14 @@ using OpenSim.Framework.Servers;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Framework.Statistics; 42using OpenSim.Framework.Statistics;
43using OpenSim.Region.ClientStack; 43using OpenSim.Region.ClientStack;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
44using OpenSim.Region.Framework; 45using OpenSim.Region.Framework;
45using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 47using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.Physics.Manager;
48using OpenSim.Server.Base; 49using OpenSim.Server.Base;
50using OpenSim.Services.Interfaces;
51using OpenSim.Services.UserAccountService;
49 52
50namespace OpenSim 53namespace OpenSim
51{ 54{
@@ -362,6 +365,53 @@ namespace OpenSim
362 365
363 scene.SetModuleInterfaces(); 366 scene.SetModuleInterfaces();
364 367
368 // FIXME: Put me into a separate method!
369 while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
370 {
371 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
372 List<char> excluded = new List<char>(new char[1]{' '});
373 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
374 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
375
376 UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
377
378 if (account == null)
379 {
380 m_log.DebugFormat("A {0}", scene.UserAccountService.GetType());
381
382// if (scene.UserAccountService is LocalUserAccountServicesConnector)
383// {
384// IUserAccountService innerUas
385// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService;
386//
387// m_log.DebugFormat("B {0}", innerUas.GetType());
388//
389// if (innerUas is UserAccountService)
390// {
391
392 if (scene.UserAccountService is UserAccountService)
393 {
394 string password = MainConsole.Instance.PasswdPrompt("Password");
395 string email = MainConsole.Instance.CmdPrompt("Email", "");
396
397 // TODO: Where do we put m_regInfo.ScopeID?
398 account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email);
399 }
400// }
401 }
402
403 if (account == null)
404 {
405 m_log.ErrorFormat(
406 "[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
407 }
408 else
409 {
410 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
411 regionInfo.EstateSettings.Save();
412 }
413 }
414
365 // Prims have to be loaded after module configuration since some modules may be invoked during the load 415 // Prims have to be loaded after module configuration since some modules may be invoked during the load
366 scene.LoadPrimsFromStorage(regionInfo.originRegionID); 416 scene.LoadPrimsFromStorage(regionInfo.originRegionID);
367 417
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
index 30ebb21..546fe88 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 } 128 }
124 129
125 public void RemoveRegion(Scene scene) 130 public void RemoveRegion(Scene scene)
@@ -147,7 +152,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
147 if (inCache) 152 if (inCache)
148 return account; 153 return account;
149 154
150 account = m_UserService.GetUserAccount(scopeID, userID); 155 account = UserAccountService.GetUserAccount(scopeID, userID);
151 m_Cache.Cache(userID, account); 156 m_Cache.Cache(userID, account);
152 157
153 return account; 158 return account;
@@ -160,7 +165,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
160 if (inCache) 165 if (inCache)
161 return account; 166 return account;
162 167
163 account = m_UserService.GetUserAccount(scopeID, firstName, lastName); 168 account = UserAccountService.GetUserAccount(scopeID, firstName, lastName);
164 if (account != null) 169 if (account != null)
165 m_Cache.Cache(account.PrincipalID, account); 170 m_Cache.Cache(account.PrincipalID, account);
166 171
@@ -169,22 +174,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
169 174
170 public UserAccount GetUserAccount(UUID scopeID, string Email) 175 public UserAccount GetUserAccount(UUID scopeID, string Email)
171 { 176 {
172 return m_UserService.GetUserAccount(scopeID, Email); 177 return UserAccountService.GetUserAccount(scopeID, Email);
173 } 178 }
174 179
175 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 180 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
176 { 181 {
177 return m_UserService.GetUserAccounts(scopeID, query); 182 return UserAccountService.GetUserAccounts(scopeID, query);
178 } 183 }
179 184
180 // Update all updatable fields 185 // Update all updatable fields
181 // 186 //
182 public bool StoreUserAccount(UserAccount data) 187 public bool StoreUserAccount(UserAccount data)
183 { 188 {
184 return m_UserService.StoreUserAccount(data); 189 return UserAccountService.StoreUserAccount(data);
185 } 190 }
186 191
187 #endregion 192 #endregion
188
189 } 193 }
190} 194} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f394a95..976e001 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1170,88 +1170,6 @@ namespace OpenSim.Region.Framework.Scenes
1170 m_dialogModule = RequestModuleInterface<IDialogModule>(); 1170 m_dialogModule = RequestModuleInterface<IDialogModule>();
1171 m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); 1171 m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
1172 m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); 1172 m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
1173
1174 // Shoving this in here for now, because we have the needed
1175 // interfaces at this point
1176 //
1177 // TODO: Find a better place for this
1178 //
1179 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1180 {
1181 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
1182 List<char> excluded = new List<char>(new char[1]{' '});
1183 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1184 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
1185
1186 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1187
1188 if (account == null)
1189 {
1190 // Create a new account
1191 account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
1192 if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
1193 {
1194 account.ServiceURLs = new Dictionary<string, object>();
1195 account.ServiceURLs["HomeURI"] = string.Empty;
1196 account.ServiceURLs["GatekeeperURI"] = string.Empty;
1197 account.ServiceURLs["InventoryServerURI"] = string.Empty;
1198 account.ServiceURLs["AssetServerURI"] = string.Empty;
1199 }
1200
1201 if (UserAccountService.StoreUserAccount(account))
1202 {
1203 string password = MainConsole.Instance.PasswdPrompt("Password");
1204 string email = MainConsole.Instance.CmdPrompt("Email", "");
1205
1206 account.Email = email;
1207 UserAccountService.StoreUserAccount(account);
1208
1209 bool success = false;
1210 success = AuthenticationService.SetPassword(account.PrincipalID, password);
1211 if (!success)
1212 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
1213 first, last);
1214
1215 GridRegion home = null;
1216 if (GridService != null)
1217 {
1218 List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
1219 if (defaultRegions != null && defaultRegions.Count >= 1)
1220 home = defaultRegions[0];
1221
1222 if (GridUserService != null && home != null)
1223 GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
1224 else
1225 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
1226 first, last);
1227
1228 }
1229 else
1230 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
1231 first, last);
1232
1233 if (InventoryService != null)
1234 success = InventoryService.CreateUserInventory(account.PrincipalID);
1235 if (!success)
1236 m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
1237 first, last);
1238
1239
1240
1241 m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
1242
1243 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1244 m_regInfo.EstateSettings.Save();
1245 }
1246 else
1247 m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
1248 }
1249 else
1250 {
1251 m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
1252 m_regInfo.EstateSettings.Save();
1253 }
1254 }
1255 } 1173 }
1256 1174
1257 #endregion 1175 #endregion