* Fixed a bug with null value handling in WebUtil.BuildQueryString()

* Changed the null check back in estate manager setup but fixed the case for an existing account being found
* Implemented SetPassword() in the SimianGrid auth connector
slimupdates
John Hurliman 2010-03-26 12:21:05 -07:00
parent dd1c1b3bcd
commit 5a2315c68c
4 changed files with 5877 additions and 5834 deletions

View File

@ -263,8 +263,12 @@ namespace OpenSim.Framework
foreach (string key in parameters.Keys) foreach (string key in parameters.Keys)
{ {
foreach (string value in parameters.GetValues(key)) string[] values = parameters.GetValues(key);
items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty))); if (values != null)
{
foreach (string value in values)
items.Add(String.Concat(key, "=", HttpUtility.UrlEncode(value ?? String.Empty)));
}
} }
return String.Join("&", items.ToArray()); return String.Join("&", items.ToArray());

View File

@ -1266,8 +1266,9 @@ namespace OpenSim.Region.Framework.Scenes
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
if (account != null) if (account == null)
{ {
// Create a new account
account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty); account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0)) if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
{ {
@ -1325,7 +1326,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
MainConsole.Instance.Output("User account not found. Please enter the name of an existing user"); m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
m_regInfo.EstateSettings.Save();
} }
} }
} }

View File

@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid
public bool SetPassword(UUID principalID, string passwd) public bool SetPassword(UUID principalID, string passwd)
{ {
// TODO: Use GetIdentities to find the md5hash identity for principalID // Fetch the user name first
// and then update it with AddIdentity NameValueCollection requestArgs = new NameValueCollection
m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); {
{ "RequestMethod", "GetUser" },
{ "UserID", principalID.ToString() }
};
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
{
OSDMap userMap = (OSDMap)response["User"];
string identifier = userMap["Name"].AsString();
if (!String.IsNullOrEmpty(identifier))
{
// Add/update the md5hash identity
requestArgs = new NameValueCollection
{
{ "RequestMethod", "AddIdentity" },
{ "Identifier", identifier },
{ "Credential", "$1$" + Utils.MD5String(passwd) },
{ "Type", "md5hash" },
{ "UserID", principalID.ToString() }
};
response = WebUtil.PostToService(m_serverUrl, requestArgs);
bool success = response["Success"].AsBoolean();
if (!success)
m_log.WarnFormat("[AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID);
return success;
}
}
else
{
m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " +
response["Message"].AsString());
}
return false; return false;
} }

File diff suppressed because it is too large Load Diff