Merge commit '522d6261f11ffaf8320c3f0775beb5d0608ce226' into bigmerge

Conflicts:
	OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
avinationmerge
Melanie 2011-10-11 21:28:23 +01:00
commit 8fac7c0650
5 changed files with 69 additions and 93 deletions

View File

@ -41,11 +41,14 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Framework.Statistics; using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack; using OpenSim.Region.ClientStack;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Services.UserAccountService;
namespace OpenSim namespace OpenSim
{ {
@ -411,6 +414,53 @@ namespace OpenSim
scene.SnmpService.BootInfo("Loading prins", scene); scene.SnmpService.BootInfo("Loading prins", scene);
} }
// FIXME: Put me into a separate method!
while (regionInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
List<char> excluded = new List<char>(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
if (account == null)
{
m_log.DebugFormat("A {0}", scene.UserAccountService.GetType());
// if (scene.UserAccountService is LocalUserAccountServicesConnector)
// {
// IUserAccountService innerUas
// = ((LocalUserAccountServicesConnector)scene.UserAccountService).UserAccountService;
//
// m_log.DebugFormat("B {0}", innerUas.GetType());
//
// if (innerUas is UserAccountService)
// {
if (scene.UserAccountService is UserAccountService)
{
string password = MainConsole.Instance.PasswdPrompt("Password");
string email = MainConsole.Instance.CmdPrompt("Email", "");
// TODO: Where do we put m_regInfo.ScopeID?
account = ((UserAccountService)scene.UserAccountService).CreateUser(first, last, password, email);
}
// }
}
if (account == null)
{
m_log.ErrorFormat(
"[OPENSIM]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
}
else
{
regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
regionInfo.EstateSettings.Save();
}
}
// Prims have to be loaded after module configuration since some modules may be invoked during the load // Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID); scene.LoadPrimsFromStorage(regionInfo.originRegionID);

View File

@ -45,7 +45,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private IUserAccountService m_UserService; /// <summary>
/// This is not on the IUserAccountService. It's only being used so that standalone scenes can punch through
/// to a local UserAccountService when setting up an estate manager.
/// </summary>
public IUserAccountService UserAccountService { get; private set; }
private UserAccountCache m_Cache; private UserAccountCache m_Cache;
private bool m_Enabled = false; private bool m_Enabled = false;
@ -86,9 +91,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
} }
Object[] args = new Object[] { source }; Object[] args = new Object[] { source };
m_UserService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args); UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args);
if (m_UserService == null) if (UserAccountService == null)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll); "[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll);
@ -119,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
if (!m_Enabled) if (!m_Enabled)
return; return;
scene.RegisterModuleInterface<IUserAccountService>(m_UserService); scene.RegisterModuleInterface<IUserAccountService>(UserAccountService);
scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache);
} }
@ -148,7 +153,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
if (inCache) if (inCache)
return account; return account;
account = m_UserService.GetUserAccount(scopeID, userID); account = UserAccountService.GetUserAccount(scopeID, userID);
m_Cache.Cache(userID, account); m_Cache.Cache(userID, account);
return account; return account;
@ -161,7 +166,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
if (inCache) if (inCache)
return account; return account;
account = m_UserService.GetUserAccount(scopeID, firstName, lastName); account = UserAccountService.GetUserAccount(scopeID, firstName, lastName);
if (account != null) if (account != null)
m_Cache.Cache(account.PrincipalID, account); m_Cache.Cache(account.PrincipalID, account);
@ -170,7 +175,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public UserAccount GetUserAccount(UUID scopeID, string Email) public UserAccount GetUserAccount(UUID scopeID, string Email)
{ {
return m_UserService.GetUserAccount(scopeID, Email); return UserAccountService.GetUserAccount(scopeID, Email);
} }
public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
@ -180,17 +185,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public List<UserAccount> GetUserAccounts(UUID scopeID, string query) public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
{ {
return m_UserService.GetUserAccounts(scopeID, query); return UserAccountService.GetUserAccounts(scopeID, query);
} }
// Update all updatable fields // Update all updatable fields
// //
public bool StoreUserAccount(UserAccount data) public bool StoreUserAccount(UserAccount data)
{ {
return m_UserService.StoreUserAccount(data); return UserAccountService.StoreUserAccount(data);
} }
#endregion #endregion
} }
} }

View File

@ -1198,88 +1198,6 @@ namespace OpenSim.Region.Framework.Scenes
m_dialogModule = RequestModuleInterface<IDialogModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>();
m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
m_teleportModule = RequestModuleInterface<IEntityTransferModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
// Shoving this in here for now, because we have the needed
// interfaces at this point
//
// TODO: Find a better place for this
//
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
List<char> excluded = new List<char>(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
if (account == null)
{
// Create a new account
account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
{
account.ServiceURLs = new Dictionary<string, object>();
account.ServiceURLs["HomeURI"] = string.Empty;
account.ServiceURLs["GatekeeperURI"] = string.Empty;
account.ServiceURLs["InventoryServerURI"] = string.Empty;
account.ServiceURLs["AssetServerURI"] = string.Empty;
}
if (UserAccountService.StoreUserAccount(account))
{
string password = MainConsole.Instance.PasswdPrompt("Password");
string email = MainConsole.Instance.CmdPrompt("Email", "");
account.Email = email;
UserAccountService.StoreUserAccount(account);
bool success = false;
success = AuthenticationService.SetPassword(account.PrincipalID, password);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
first, last);
GridRegion home = null;
if (GridService != null)
{
List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
if (defaultRegions != null && defaultRegions.Count >= 1)
home = defaultRegions[0];
if (GridUserService != null && home != null)
GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
first, last);
}
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
first, last);
if (InventoryService != null)
success = InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
first, last);
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
}
else
m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
}
else
{
m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
}
}
} }
#endregion #endregion

View File

@ -475,7 +475,7 @@ namespace OpenSim.Services.UserAccountService
/// <param name="lastName"></param> /// <param name="lastName"></param>
/// <param name="password"></param> /// <param name="password"></param>
/// <param name="email"></param> /// <param name="email"></param>
private void CreateUser(string firstName, string lastName, string password, string email) public UserAccount CreateUser(string firstName, string lastName, string password, string email)
{ {
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName); UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (null == account) if (null == account)
@ -543,6 +543,8 @@ namespace OpenSim.Services.UserAccountService
{ {
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName); m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
} }
return account;
} }
private void CreateDefaultAppearanceEntries(UUID principalID) private void CreateDefaultAppearanceEntries(UUID principalID)

View File

@ -1871,6 +1871,8 @@
<Reference name="OpenSim.Region.ClientStack"/> <Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Framework.Communications"/> <Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Server.Base"/> <Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.UserAccountService"/>
<Reference name="XMLRPC" path="../../../bin/"/> <Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="Nini" path="../../../bin/"/> <Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/> <Reference name="log4net" path="../../../bin/"/>