mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 20:05:33 +08:00
Add a user server XMLRPC method to set the MOTD and the minimum GodLevel
required to log in. set_login_params accepts avatar_uuid and password of a user with god level 200 or more, and allows setting either or both the login_motd or login_level
This commit is contained in:
@@ -146,6 +146,7 @@ namespace OpenSim.Grid.UserServer
|
||||
m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
|
||||
m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", m_userManager.XmlRPCGetAgentMethodUUID);
|
||||
m_httpServer.AddXmlRPCHandler("check_auth_session", m_userManager.XmlRPCCheckAuthSession);
|
||||
m_httpServer.AddXmlRPCHandler("set_login_params", m_loginService.XmlRPCSetLoginParams);
|
||||
// Message Server ---> User Server
|
||||
m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
|
||||
m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
|
||||
|
||||
@@ -437,5 +437,48 @@ namespace OpenSim.Grid.UserServer
|
||||
"A root inventory folder for user {0} could not be retrieved from the inventory service",
|
||||
userID));
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
UserProfileData userProfile;
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
UUID uid;
|
||||
string pass = requestData["password"].ToString();
|
||||
|
||||
if(!UUID.TryParse((string) requestData["avatar_uuid"], out uid))
|
||||
{
|
||||
responseData["error"] = "No authorization";
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
userProfile = m_userManager.GetUserProfile(uid);
|
||||
|
||||
if (userProfile == null ||
|
||||
(!AuthenticateUser(userProfile, pass)) ||
|
||||
userProfile.GodLevel < 200)
|
||||
{
|
||||
responseData["error"] = "No authorization";
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
if (requestData.ContainsKey("login_level"))
|
||||
{
|
||||
m_minLoginLevel = Convert.ToInt32(requestData["login_level"]);
|
||||
}
|
||||
|
||||
if (requestData.ContainsKey("login_motd"))
|
||||
{
|
||||
m_welcomeMessage = requestData["login_motd"].ToString();
|
||||
}
|
||||
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user