Renaming UserManagerBase.SetUserProfile(UserProfileData) to
UserManager.UpdateUserProfile(UserProfileData). Adding UpdateUserProfile(UserProfileData) to IUserService interface. Adding RemoteAdminPlugin.XmlRpcUpdateUserAccountMethod(...) to provide a remote update capability.0.6.0-stable
parent
2dadbc2f70
commit
6265a09ff9
|
@ -86,6 +86,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
|
m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod);
|
||||||
m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod);
|
m_httpd.AddXmlRPCHandler("admin_load_heightmap", XmlRpcLoadHeightmapMethod);
|
||||||
m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
|
m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
|
||||||
|
m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod);
|
||||||
m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
|
m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -564,6 +565,111 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the password of a user account.
|
||||||
|
/// <summary>
|
||||||
|
/// <param name="request">incoming XML RPC request</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// XmlRpcUpdateUserAccountMethod takes the following XMLRPC
|
||||||
|
/// parameters
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader><term>parameter name</term><description>description</description></listheader>
|
||||||
|
/// <item><term>password</term>
|
||||||
|
/// <description>admin password as set in OpenSim.ini</description></item>
|
||||||
|
/// <item><term>user_firstname</term>
|
||||||
|
/// <description>avatar's first name (cannot be changed)</description></item>
|
||||||
|
/// <item><term>user_lastname</term>
|
||||||
|
/// <description>avatar's last name (cannot be changed)</description></item>
|
||||||
|
/// <item><term>user_password</term>
|
||||||
|
/// <description>avatar's password (changeable)</description></item>
|
||||||
|
/// <item><term>start_region_x</term>
|
||||||
|
/// <description>avatar's start region coordinates, X
|
||||||
|
/// value (changeable)</description></item>
|
||||||
|
/// <item><term>start_region_y</term>
|
||||||
|
/// <description>avatar's start region coordinates, Y
|
||||||
|
/// value (changeable)</description></item>
|
||||||
|
/// </list>
|
||||||
|
///
|
||||||
|
/// XmlRpcCreateUserMethod returns
|
||||||
|
/// <list type="table">
|
||||||
|
/// <listheader><term>name</term><description>description</description></listheader>
|
||||||
|
/// <item><term>success</term>
|
||||||
|
/// <description>true or false</description></item>
|
||||||
|
/// <item><term>error</term>
|
||||||
|
/// <description>error message if success is false</description></item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
public XmlRpcResponse XmlRpcUpdateUserAccountMethod(XmlRpcRequest request)
|
||||||
|
{
|
||||||
|
m_log.Info("[RADMIN]: UpdateUserAccount: new request");
|
||||||
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
Hashtable responseData = new Hashtable();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Hashtable requestData = (Hashtable) request.Params[0];
|
||||||
|
|
||||||
|
// check completeness
|
||||||
|
checkStringParameters(request, new string[] { "password", "user_firstname",
|
||||||
|
"user_lastname" });
|
||||||
|
|
||||||
|
// check password
|
||||||
|
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||||
|
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||||
|
|
||||||
|
// do the job
|
||||||
|
string firstname = (string) requestData["user_firstname"];
|
||||||
|
string lastname = (string) requestData["user_lastname"];
|
||||||
|
|
||||||
|
|
||||||
|
string passwd = String.Empty;
|
||||||
|
uint? regX = null;
|
||||||
|
uint? regY = null;
|
||||||
|
|
||||||
|
if (requestData.ContainsKey("user_password")) passwd = (string) requestData["user_password"];
|
||||||
|
if (requestData.ContainsKey("start_region_x")) regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
|
||||||
|
if (requestData.ContainsKey("start_region_y")) regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
|
||||||
|
|
||||||
|
if (String.Empty == passwd && null == regX && null == regY)
|
||||||
|
throw new Exception("neither user_password nor start_region_x nor start_region_y provided");
|
||||||
|
|
||||||
|
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
||||||
|
if (null == userProfile)
|
||||||
|
throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
|
||||||
|
|
||||||
|
if (null != passwd)
|
||||||
|
{
|
||||||
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
|
||||||
|
userProfile.PasswordHash = md5PasswdHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != regX) userProfile.HomeRegionX = (uint)regX;
|
||||||
|
if (null != regY) userProfile.HomeRegionY = (uint)regY;
|
||||||
|
|
||||||
|
if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile))
|
||||||
|
throw new Exception("did not manage to update user profile");
|
||||||
|
|
||||||
|
responseData["success"] = "true";
|
||||||
|
|
||||||
|
response.Value = responseData;
|
||||||
|
|
||||||
|
m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname,
|
||||||
|
userProfile.ID);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.Message);
|
||||||
|
m_log.DebugFormat("[RADMIN] UpdateUserAccount: failed: {0}", e.ToString());
|
||||||
|
|
||||||
|
responseData["success"] = "false";
|
||||||
|
responseData["error"] = e.Message;
|
||||||
|
|
||||||
|
response.Value = responseData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request)
|
public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request)
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: Received Load XML Administrator Request");
|
m_log.Info("[RADMIN]: Received Load XML Administrator Request");
|
||||||
|
|
|
@ -64,6 +64,13 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the user's profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">UserProfileData object with updated data. Should be obtained
|
||||||
|
/// via a call to GetUserProfile().</param>
|
||||||
|
/// <returns>true if the update could be applied, false if it could not be applied.</returns>
|
||||||
|
bool UpdateUserProfile(UserProfileData data);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new friend to the database for XUser
|
/// Adds a new friend to the database for XUser
|
||||||
|
|
|
@ -153,11 +153,11 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set's user profile from data object
|
/// Updates a user profile from data object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool SetUserProfile(UserProfileData data)
|
public bool UpdateUserProfile(UserProfileData data)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
foreach (KeyValuePair<string, IUserData> plugin in _plugins)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,8 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Info("[USERSTORAGE]: Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
|
m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName,
|
||||||
|
plugin.Key, e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -352,7 +353,7 @@ namespace OpenSim.Framework.Communications
|
||||||
UserProfileData profile = GetUserProfile(agentID);
|
UserProfileData profile = GetUserProfile(agentID);
|
||||||
profile.CurrentAgent = null;
|
profile.CurrentAgent = null;
|
||||||
|
|
||||||
SetUserProfile(profile);
|
UpdateUserProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,7 +540,7 @@ namespace OpenSim.Framework.Communications
|
||||||
// TODO: what is the logic should be?
|
// TODO: what is the logic should be?
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
ret = AddUserAgent(profile.CurrentAgent);
|
ret = AddUserAgent(profile.CurrentAgent);
|
||||||
ret = ret & SetUserProfile(profile);
|
ret = ret & UpdateUserProfile(profile);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -437,6 +437,12 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
public bool UpdateUserProfile(UserProfileData data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
public bool UpdateUserProfileProperties(UserProfileData UserProfile)
|
||||||
{
|
{
|
||||||
m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile.");
|
m_log.Debug("[OGS1 USER SERVICES]: Asking UserServer to update profile.");
|
||||||
|
|
Loading…
Reference in New Issue