aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2008-10-01 15:17:37 +0000
committerMelanie Thielker2008-10-01 15:17:37 +0000
commitfecbb2febd04ec1ad26d0a38930c61cad372b6c6 (patch)
tree5d41cc81fa38a7c224504005fc3e9fcbb0596f44
parenta little (incomplete) hackery in the IRC module to allow run-time connection ... (diff)
downloadopensim-SC_OLD-fecbb2febd04ec1ad26d0a38930c61cad372b6c6.zip
opensim-SC_OLD-fecbb2febd04ec1ad26d0a38930c61cad372b6c6.tar.gz
opensim-SC_OLD-fecbb2febd04ec1ad26d0a38930c61cad372b6c6.tar.bz2
opensim-SC_OLD-fecbb2febd04ec1ad26d0a38930c61cad372b6c6.tar.xz
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
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs16
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs9
-rw-r--r--OpenSim/Grid/UserServer/Main.cs1
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs43
4 files changed, 69 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index db504f9..b2565b1 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -275,6 +275,22 @@ namespace OpenSim.Framework.Communications
275 "false"); 275 "false");
276 } 276 }
277 277
278 public XmlRpcResponse CreateLoginBlockedResponse()
279 {
280 return
281 (GenerateFailureResponse("presence",
282 "Logins are currently restricted. Please try again later",
283 "false"));
284 }
285
286 public LLSD CreateLoginBlockedResponseLLSD()
287 {
288 return GenerateFailureResponseLLSD(
289 "presence",
290 "Logins are currently restricted. Please try again later",
291 "false");
292 }
293
278 public XmlRpcResponse CreateDeadRegionResponse() 294 public XmlRpcResponse CreateDeadRegionResponse()
279 { 295 {
280 return 296 return
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 7a39a97..7a657b5 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Framework.Communications
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 protected string m_welcomeMessage = "Welcome to OpenSim"; 49 protected string m_welcomeMessage = "Welcome to OpenSim";
50 protected int m_minLoginLevel = 0;
50 protected UserManagerBase m_userManager = null; 51 protected UserManagerBase m_userManager = null;
51 protected Mutex m_loginMutex = new Mutex(false); 52 protected Mutex m_loginMutex = new Mutex(false);
52 53
@@ -196,6 +197,10 @@ namespace OpenSim.Framework.Communications
196 197
197 return logResponse.CreateLoginFailedResponse(); 198 return logResponse.CreateLoginFailedResponse();
198 } 199 }
200 else if (userProfile.GodLevel < m_minLoginLevel)
201 {
202 return logResponse.CreateLoginBlockedResponse();
203 }
199 else 204 else
200 { 205 {
201 // If we already have a session... 206 // If we already have a session...
@@ -363,6 +368,10 @@ namespace OpenSim.Framework.Communications
363 { 368 {
364 return logResponse.CreateLoginFailedResponseLLSD(); 369 return logResponse.CreateLoginFailedResponseLLSD();
365 } 370 }
371 else if (userProfile.GodLevel < m_minLoginLevel)
372 {
373 return logResponse.CreateLoginBlockedResponseLLSD();
374 }
366 else 375 else
367 { 376 {
368 // If we already have a session... 377 // If we already have a session...
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 55e681a..7fb664f 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -146,6 +146,7 @@ namespace OpenSim.Grid.UserServer
146 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); 146 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
147 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", m_userManager.XmlRPCGetAgentMethodUUID); 147 m_httpServer.AddXmlRPCHandler("get_agent_by_uuid", m_userManager.XmlRPCGetAgentMethodUUID);
148 m_httpServer.AddXmlRPCHandler("check_auth_session", m_userManager.XmlRPCCheckAuthSession); 148 m_httpServer.AddXmlRPCHandler("check_auth_session", m_userManager.XmlRPCCheckAuthSession);
149 m_httpServer.AddXmlRPCHandler("set_login_params", m_loginService.XmlRPCSetLoginParams);
149 // Message Server ---> User Server 150 // Message Server ---> User Server
150 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); 151 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
151 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); 152 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 573e546..bfa454c 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -437,5 +437,48 @@ namespace OpenSim.Grid.UserServer
437 "A root inventory folder for user {0} could not be retrieved from the inventory service", 437 "A root inventory folder for user {0} could not be retrieved from the inventory service",
438 userID)); 438 userID));
439 } 439 }
440
441 public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request)
442 {
443 XmlRpcResponse response = new XmlRpcResponse();
444 Hashtable requestData = (Hashtable) request.Params[0];
445 UserProfileData userProfile;
446 Hashtable responseData = new Hashtable();
447
448 UUID uid;
449 string pass = requestData["password"].ToString();
450
451 if(!UUID.TryParse((string) requestData["avatar_uuid"], out uid))
452 {
453 responseData["error"] = "No authorization";
454 response.Value = responseData;
455 return response;
456 }
457
458 userProfile = m_userManager.GetUserProfile(uid);
459
460 if (userProfile == null ||
461 (!AuthenticateUser(userProfile, pass)) ||
462 userProfile.GodLevel < 200)
463 {
464 responseData["error"] = "No authorization";
465 response.Value = responseData;
466 return response;
467 }
468
469 if (requestData.ContainsKey("login_level"))
470 {
471 m_minLoginLevel = Convert.ToInt32(requestData["login_level"]);
472 }
473
474 if (requestData.ContainsKey("login_motd"))
475 {
476 m_welcomeMessage = requestData["login_motd"].ToString();
477 }
478
479 response.Value = responseData;
480 return response;
481 }
482
440 } 483 }
441} 484}