Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2010-05-28 21:56:42 +01:00
22 changed files with 1127 additions and 1058 deletions

View File

@@ -54,7 +54,8 @@ namespace OpenSim.Services.PresenceService
public bool LoginAgent(string userID, UUID sessionID,
UUID secureSessionID)
{
PresenceData[] d = m_Database.Get("UserID", userID);
//PresenceData[] d = m_Database.Get("UserID", userID);
m_Database.Get("UserID", userID);
PresenceData data = new PresenceData();

View File

@@ -277,8 +277,9 @@ namespace OpenSim.Services.UserAccountService
#endregion
#region Console commands
/// <summary>
/// Create a new user
/// Handle the create user command from the console.
/// </summary>
/// <param name="cmdparams">string array with parameters: firstname, lastname, password, locationX, locationY, email</param>
protected void HandleCreateUser(string module, string[] cmdparams)
@@ -304,61 +305,7 @@ namespace OpenSim.Services.UserAccountService
email = MainConsole.Instance.CmdPrompt("Email", "");
else email = cmdparams[5];
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (null == account)
{
account = new UserAccount(UUID.Zero, firstName, lastName, email);
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 (StoreUserAccount(account))
{
bool success = false;
if (m_AuthenticationService != null)
success = m_AuthenticationService.SetPassword(account.PrincipalID, password);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
firstName, lastName);
GridRegion home = null;
if (m_GridService != null)
{
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero);
if (defaultRegions != null && defaultRegions.Count >= 1)
home = defaultRegions[0];
if (m_GridUserService != null && home != null)
m_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}.",
firstName, lastName);
}
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
firstName, lastName);
if (m_InventoryService != null)
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
firstName, lastName);
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
}
}
else
{
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
}
CreateUser(firstName, lastName, password, email);
}
protected void HandleResetUserPassword(string module, string[] cmdparams)
@@ -395,5 +342,67 @@ namespace OpenSim.Services.UserAccountService
#endregion
/// <summary>
/// Create a user
/// </summary>
/// <param name="firstName"></param>
/// <param name="lastName"></param>
/// <param name="password"></param>
/// <param name="email"></param>
public void CreateUser(string firstName, string lastName, string password, string email)
{
UserAccount account = GetUserAccount(UUID.Zero, firstName, lastName);
if (null == account)
{
account = new UserAccount(UUID.Zero, firstName, lastName, email);
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 (StoreUserAccount(account))
{
bool success = false;
if (m_AuthenticationService != null)
success = m_AuthenticationService.SetPassword(account.PrincipalID, password);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
firstName, lastName);
GridRegion home = null;
if (m_GridService != null)
{
List<GridRegion> defaultRegions = m_GridService.GetDefaultRegions(UUID.Zero);
if (defaultRegions != null && defaultRegions.Count >= 1)
home = defaultRegions[0];
if (m_GridUserService != null && home != null)
m_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}.",
firstName, lastName);
}
else
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
firstName, lastName);
if (m_InventoryService != null)
success = m_InventoryService.CreateUserInventory(account.PrincipalID);
if (!success)
m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
firstName, lastName);
m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", firstName, lastName);
}
}
else
{
m_log.ErrorFormat("[USER ACCOUNT SERVICE]: A user with the name {0} {1} already exists!", firstName, lastName);
}
}
}
}