aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs7
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs407
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/Resources/RemoteAdminPlugin.addin.xml11
3 files changed, 360 insertions, 65 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
index 8ad948c..ce87400 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
@@ -1,6 +1,7 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices; 2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 3using System.Runtime.InteropServices;
4using Mono.Addins;
4 5
5// General Information about an assembly is controlled through the following 6// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 7// set of attributes. Change these attribute values to modify the information
@@ -29,5 +30,7 @@ using System.Runtime.InteropServices;
29// Build Number 30// Build Number
30// Revision 31// Revision
31// 32//
32[assembly: AssemblyVersion("0.7.5.*")] 33[assembly: AssemblyVersion("0.8.3.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")] 34
35[assembly: Addin("OpenSim.ApplicationPlugins.RemoteController", OpenSim.VersionInfo.VersionNumber)]
36[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index a75d10d..808d9e4 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Globalization;
31using System.IO; 32using System.IO;
32using System.Xml; 33using System.Xml;
33using System.Net; 34using System.Net;
@@ -38,9 +39,9 @@ using log4net;
38using Nini.Config; 39using Nini.Config;
39using Nwc.XmlRpc; 40using Nwc.XmlRpc;
40using OpenMetaverse; 41using OpenMetaverse;
42using Mono.Addins;
41using OpenSim; 43using OpenSim;
42using OpenSim.Framework; 44using OpenSim.Framework;
43using OpenSim.Framework.Communications;
44using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
45using OpenSim.Framework.Servers; 46using OpenSim.Framework.Servers;
46using OpenSim.Framework.Servers.HttpServer; 47using OpenSim.Framework.Servers.HttpServer;
@@ -50,9 +51,12 @@ using OpenSim.Region.Framework.Scenes;
50using OpenSim.Services.Interfaces; 51using OpenSim.Services.Interfaces;
51using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; 52using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion; 53using GridRegion = OpenSim.Services.Interfaces.GridRegion;
54using PermissionMask = OpenSim.Framework.PermissionMask;
55using RegionInfo = OpenSim.Framework.RegionInfo;
53 56
54namespace OpenSim.ApplicationPlugins.RemoteController 57namespace OpenSim.ApplicationPlugins.RemoteController
55{ 58{
59 [Extension(Path = "/OpenSim/Startup", Id = "LoadRegions", NodeName = "Plugin")]
56 public class RemoteAdminPlugin : IApplicationPlugin 60 public class RemoteAdminPlugin : IApplicationPlugin
57 { 61 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -136,6 +140,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
136 availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod); 140 availableMethods["admin_save_heightmap"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcSaveHeightmapMethod);
137 141
138 // Agent management 142 // Agent management
143 availableMethods["admin_get_agents"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetAgentsMethod);
139 availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod); 144 availableMethods["admin_teleport_agent"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcTeleportAgentMethod);
140 145
141 // User management 146 // User management
@@ -143,6 +148,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
143 availableMethods["admin_create_user_email"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateUserMethod); 148 availableMethods["admin_create_user_email"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcCreateUserMethod);
144 availableMethods["admin_exists_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUserExistsMethod); 149 availableMethods["admin_exists_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUserExistsMethod);
145 availableMethods["admin_update_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUpdateUserAccountMethod); 150 availableMethods["admin_update_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcUpdateUserAccountMethod);
151 availableMethods["admin_authenticate_user"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAuthenticateUserMethod);
146 152
147 // Region state management 153 // Region state management
148 availableMethods["admin_load_xml"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadXMLMethod); 154 availableMethods["admin_load_xml"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcLoadXMLMethod);
@@ -155,6 +161,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
155 availableMethods["admin_acl_add"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListAdd); 161 availableMethods["admin_acl_add"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListAdd);
156 availableMethods["admin_acl_remove"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListRemove); 162 availableMethods["admin_acl_remove"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListRemove);
157 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList); 163 availableMethods["admin_acl_list"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcAccessListList);
164 availableMethods["admin_estate_reload"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcEstateReload);
165
166 // Land management
167 availableMethods["admin_reset_land"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcResetLand);
158 168
159 // Either enable full remote functionality or just selected features 169 // Either enable full remote functionality or just selected features
160 string enabledMethods = m_config.GetString("enabled_methods", "all"); 170 string enabledMethods = m_config.GetString("enabled_methods", "all");
@@ -324,18 +334,26 @@ namespace OpenSim.ApplicationPlugins.RemoteController
324 // k, (string)requestData[k], ((string)requestData[k]).Length); 334 // k, (string)requestData[k], ((string)requestData[k]).Length);
325 // } 335 // }
326 336
327 CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"}); 337 CheckStringParameters(requestData, responseData, new string[] { "filename" });
328 CheckRegionParams(requestData, responseData); 338 CheckRegionParams(requestData, responseData);
329 339
330 Scene scene = null; 340 Scene scene = null;
331 GetSceneFromRegionParams(requestData, responseData, out scene); 341 GetSceneFromRegionParams(requestData, responseData, out scene);
332 string file = (string)requestData["filename"];
333 342
334 responseData["accepted"] = true; 343 if (scene != null)
344 {
345 string file = (string)requestData["filename"];
335 346
336 LoadHeightmap(file, scene.RegionInfo.RegionID); 347 responseData["accepted"] = true;
337 348
338 responseData["success"] = true; 349 LoadHeightmap(file, scene.RegionInfo.RegionID);
350
351 responseData["success"] = true;
352 }
353 else
354 {
355 responseData["success"] = false;
356 }
339 357
340 m_log.Info("[RADMIN]: Load height maps request complete"); 358 m_log.Info("[RADMIN]: Load height maps request complete");
341 } 359 }
@@ -349,23 +367,30 @@ namespace OpenSim.ApplicationPlugins.RemoteController
349 367
350// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); 368// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
351 369
352 CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" }); 370 CheckStringParameters(requestData, responseData, new string[] { "filename" });
353 CheckRegionParams(requestData, responseData); 371 CheckRegionParams(requestData, responseData);
354 372
355 Scene region = null; 373 Scene scene = null;
356 GetSceneFromRegionParams(requestData, responseData, out region); 374 GetSceneFromRegionParams(requestData, responseData, out scene);
357 375
358 string file = (string)requestData["filename"]; 376 if (scene != null)
359 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); 377 {
378 string file = (string)requestData["filename"];
379 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
360 380
361 responseData["accepted"] = true; 381 responseData["accepted"] = true;
362 382
363 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); 383 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
364 if (null == terrainModule) throw new Exception("terrain module not available"); 384 if (null == terrainModule) throw new Exception("terrain module not available");
365 385
366 terrainModule.SaveToFile(file); 386 terrainModule.SaveToFile(file);
367 387
368 responseData["success"] = true; 388 responseData["success"] = true;
389 }
390 else
391 {
392 responseData["success"] = false;
393 }
369 394
370 m_log.Info("[RADMIN]: Save height maps request complete"); 395 m_log.Info("[RADMIN]: Save height maps request complete");
371 } 396 }
@@ -673,7 +698,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
673 region.EstateSettings.EstateName = (string) requestData["estate_name"]; 698 region.EstateSettings.EstateName = (string) requestData["estate_name"];
674 region.EstateSettings.EstateOwner = userID; 699 region.EstateSettings.EstateOwner = userID;
675 // Persistence does not seem to effect the need to save a new estate 700 // Persistence does not seem to effect the need to save a new estate
676 region.EstateSettings.Save(); 701 m_application.EstateDataService.StoreEstateSettings(region.EstateSettings);
677 702
678 if (!m_application.EstateDataService.LinkRegion(region.RegionID, (int) region.EstateSettings.EstateID)) 703 if (!m_application.EstateDataService.LinkRegion(region.RegionID, (int) region.EstateSettings.EstateID))
679 throw new Exception("Failed to join estate."); 704 throw new Exception("Failed to join estate.");
@@ -698,11 +723,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
698 723
699 IScene newScene; 724 IScene newScene;
700 m_application.CreateRegion(region, out newScene); 725 m_application.CreateRegion(region, out newScene);
726 newScene.Start();
701 727
702 // If an access specification was provided, use it. 728 // If an access specification was provided, use it.
703 // Otherwise accept the default. 729 // Otherwise accept the default.
704 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); 730 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
705 newScene.RegionInfo.EstateSettings.Save(); 731 m_application.EstateDataService.StoreEstateSettings(newScene.RegionInfo.EstateSettings);
706 732
707 // enable voice on newly created region if 733 // enable voice on newly created region if
708 // requested by either the XmlRpc request or the 734 // requested by either the XmlRpc request or the
@@ -888,7 +914,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
888 scene.RegionInfo.EstateSettings.PublicAccess = 914 scene.RegionInfo.EstateSettings.PublicAccess =
889 GetBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess); 915 GetBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess);
890 if (scene.RegionInfo.Persistent) 916 if (scene.RegionInfo.Persistent)
891 scene.RegionInfo.EstateSettings.Save(); 917 m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
892 918
893 if (requestData.ContainsKey("enable_voice")) 919 if (requestData.ContainsKey("enable_voice"))
894 { 920 {
@@ -1000,7 +1026,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1000 // Set home position 1026 // Set home position
1001 1027
1002 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 1028 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
1003 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); 1029 (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
1004 if (null == home) 1030 if (null == home)
1005 { 1031 {
1006 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstName, lastName); 1032 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", firstName, lastName);
@@ -1092,7 +1118,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1092 { 1118 {
1093 GridUserInfo userInfo = m_application.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString()); 1119 GridUserInfo userInfo = m_application.SceneManager.CurrentOrFirstScene.GridUserService.GetGridUserInfo(account.PrincipalID.ToString());
1094 if (userInfo != null) 1120 if (userInfo != null)
1095 responseData["lastlogin"] = userInfo.Login; 1121 responseData["lastlogin"] = Util.ToUnixTime(userInfo.Login);
1096 else 1122 else
1097 responseData["lastlogin"] = 0; 1123 responseData["lastlogin"] = 0;
1098 1124
@@ -1230,7 +1256,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1230 if ((null != regionXLocation) && (null != regionYLocation)) 1256 if ((null != regionXLocation) && (null != regionYLocation))
1231 { 1257 {
1232 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 1258 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
1233 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); 1259 (int)Util.RegionToWorldLoc((uint)regionXLocation), (int)Util.RegionToWorldLoc((uint)regionYLocation));
1234 if (null == home) { 1260 if (null == home) {
1235 m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName); 1261 m_log.WarnFormat("[RADMIN]: Unable to set home region for updated user account {0} {1}", firstName, lastName);
1236 } else { 1262 } else {
@@ -1262,6 +1288,139 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1262 } 1288 }
1263 1289
1264 /// <summary> 1290 /// <summary>
1291 /// Authenticate an user.
1292 /// <summary>
1293 /// <param name="request">incoming XML RPC request</param>
1294 /// <remarks>
1295 /// XmlRpcAuthenticateUserMethod takes the following XMLRPC
1296 /// parameters
1297 /// <list type="table">
1298 /// <listheader><term>parameter name</term><description>description</description></listheader>
1299 /// <item><term>password</term>
1300 /// <description>admin password as set in OpenSim.ini</description></item>
1301 /// <item><term>user_firstname</term>
1302 /// <description>avatar's first name</description></item>
1303 /// <item><term>user_lastname</term>
1304 /// <description>avatar's last name</description></item>
1305 /// <item><term>user_password</term>
1306 /// <description>MD5 hash of avatar's password</description></item>
1307 /// <item><term>token_lifetime</term>
1308 /// <description>the lifetime of the returned token (upper bounded to 30s)</description></item>
1309 /// </list>
1310 ///
1311 /// XmlRpcAuthenticateUserMethod returns
1312 /// <list type="table">
1313 /// <listheader><term>name</term><description>description</description></listheader>
1314 /// <item><term>success</term>
1315 /// <description>true or false</description></item>
1316 /// <item><term>token</term>
1317 /// <description>the authentication token sent by OpenSim</description></item>
1318 /// <item><term>error</term>
1319 /// <description>error message if success is false</description></item>
1320 /// </list>
1321 /// </remarks>
1322 private void XmlRpcAuthenticateUserMethod(XmlRpcRequest request, XmlRpcResponse response,
1323 IPEndPoint remoteClient)
1324 {
1325 m_log.Info("[RADMIN]: AuthenticateUser: new request");
1326
1327 var responseData = (Hashtable)response.Value;
1328 var requestData = (Hashtable)request.Params[0];
1329
1330 lock (m_requestLock)
1331 {
1332 try
1333 {
1334 CheckStringParameters(requestData, responseData, new[]
1335 {
1336 "user_firstname",
1337 "user_lastname",
1338 "user_password",
1339 "token_lifetime"
1340 });
1341
1342 var firstName = (string)requestData["user_firstname"];
1343 var lastName = (string)requestData["user_lastname"];
1344 var password = (string)requestData["user_password"];
1345
1346 var scene = m_application.SceneManager.CurrentOrFirstScene;
1347
1348 if (scene.Equals(null))
1349 {
1350 m_log.Debug("scene does not exist");
1351 throw new Exception("Scene does not exist.");
1352 }
1353
1354 var scopeID = scene.RegionInfo.ScopeID;
1355 var account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
1356
1357 if (account.Equals(null) || account.PrincipalID.Equals(UUID.Zero))
1358 {
1359 m_log.DebugFormat("avatar {0} {1} does not exist", firstName, lastName);
1360 throw new Exception(String.Format("avatar {0} {1} does not exist", firstName, lastName));
1361 }
1362
1363 if (String.IsNullOrEmpty(password))
1364 {
1365 m_log.DebugFormat("[RADMIN]: AuthenticateUser: no password provided for {0} {1}", firstName,
1366 lastName);
1367 throw new Exception(String.Format("no password provided for {0} {1}", firstName,
1368 lastName));
1369 }
1370
1371 int lifetime;
1372 if (int.TryParse((string)requestData["token_lifetime"], NumberStyles.Integer, CultureInfo.InvariantCulture, out lifetime) == false)
1373 {
1374 m_log.DebugFormat("[RADMIN]: AuthenticateUser: no token lifetime provided for {0} {1}", firstName,
1375 lastName);
1376 throw new Exception(String.Format("no token lifetime provided for {0} {1}", firstName,
1377 lastName));
1378 }
1379
1380 // Upper bound on lifetime set to 30s.
1381 if (lifetime > 30)
1382 {
1383 m_log.DebugFormat("[RADMIN]: AuthenticateUser: token lifetime longer than 30s for {0} {1}", firstName,
1384 lastName);
1385 throw new Exception(String.Format("token lifetime longer than 30s for {0} {1}", firstName,
1386 lastName));
1387 }
1388
1389 var authModule = scene.RequestModuleInterface<IAuthenticationService>();
1390 if (authModule == null)
1391 {
1392 m_log.Debug("[RADMIN]: AuthenticateUser: no authentication module loded");
1393 throw new Exception("no authentication module loaded");
1394 }
1395
1396 var token = authModule.Authenticate(account.PrincipalID, password, lifetime);
1397 if (String.IsNullOrEmpty(token))
1398 {
1399 m_log.DebugFormat("[RADMIN]: AuthenticateUser: authentication failed for {0} {1}", firstName,
1400 lastName);
1401 throw new Exception(String.Format("authentication failed for {0} {1}", firstName,
1402 lastName));
1403 }
1404
1405 m_log.DebugFormat("[RADMIN]: AuthenticateUser: account for user {0} {1} identified with token {2}",
1406 firstName, lastName, token);
1407
1408 responseData["token"] = token;
1409 responseData["success"] = true;
1410
1411 }
1412 catch (Exception e)
1413 {
1414 responseData["success"] = false;
1415 responseData["error"] = e.Message;
1416 throw e;
1417 }
1418
1419 m_log.Info("[RADMIN]: AuthenticateUser: request complete");
1420 }
1421 }
1422
1423 /// <summary>
1265 /// Load an OAR file into a region.. 1424 /// Load an OAR file into a region..
1266 /// <summary> 1425 /// <summary>
1267 /// <param name="request">incoming XML RPC request</param> 1426 /// <param name="request">incoming XML RPC request</param>
@@ -1329,8 +1488,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1329 } 1488 }
1330 1489
1331 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>(); 1490 IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
1491 Dictionary<string, object> archiveOptions = new Dictionary<string,object>();
1492 if (mergeOar) archiveOptions.Add("merge", null);
1493 if (skipAssets) archiveOptions.Add("skipAssets", null);
1332 if (archiver != null) 1494 if (archiver != null)
1333 archiver.DearchiveRegion(filename, mergeOar, skipAssets, Guid.Empty); 1495 archiver.DearchiveRegion(filename, Guid.Empty, archiveOptions);
1334 else 1496 else
1335 throw new Exception("Archiver module not present for scene"); 1497 throw new Exception("Archiver module not present for scene");
1336 1498
@@ -1389,7 +1551,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1389 /// </remarks> 1551 /// </remarks>
1390 private void XmlRpcSaveOARMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 1552 private void XmlRpcSaveOARMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1391 { 1553 {
1392 m_log.Info("[RADMIN]: Received Save OAR Administrator Request"); 1554 m_log.Info("[RADMIN]: Received Save OAR Request");
1393 1555
1394 Hashtable responseData = (Hashtable)response.Value; 1556 Hashtable responseData = (Hashtable)response.Value;
1395 Hashtable requestData = (Hashtable)request.Params[0]; 1557 Hashtable requestData = (Hashtable)request.Params[0];
@@ -1435,8 +1597,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1435 1597
1436 if (archiver != null) 1598 if (archiver != null)
1437 { 1599 {
1600 Guid requestId = Guid.NewGuid();
1438 scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; 1601 scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted;
1439 archiver.ArchiveRegion(filename, options); 1602
1603 m_log.InfoFormat(
1604 "[RADMIN]: Submitting save OAR request for {0} to file {1}, request ID {2}",
1605 scene.Name, filename, requestId);
1606
1607 archiver.ArchiveRegion(filename, requestId, options);
1440 1608
1441 lock (m_saveOarLock) 1609 lock (m_saveOarLock)
1442 Monitor.Wait(m_saveOarLock,5000); 1610 Monitor.Wait(m_saveOarLock,5000);
@@ -1457,12 +1625,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1457 throw e; 1625 throw e;
1458 } 1626 }
1459 1627
1460 m_log.Info("[RADMIN]: Save OAR Administrator Request complete"); 1628 m_log.Info("[RADMIN]: Save OAR Request complete");
1461 } 1629 }
1462 1630
1463 private void RemoteAdminOarSaveCompleted(Guid uuid, string name) 1631 private void RemoteAdminOarSaveCompleted(Guid uuid, string name)
1464 { 1632 {
1465 m_log.DebugFormat("[RADMIN]: File processing complete for {0}", name); 1633 if (name != "")
1634 m_log.ErrorFormat("[RADMIN]: Saving of OAR file with request ID {0} failed with message {1}", uuid, name);
1635 else
1636 m_log.DebugFormat("[RADMIN]: Saved OAR file for request {0}", uuid);
1637
1466 lock (m_saveOarLock) 1638 lock (m_saveOarLock)
1467 Monitor.Pulse(m_saveOarLock); 1639 Monitor.Pulse(m_saveOarLock);
1468 } 1640 }
@@ -1624,7 +1796,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1624 scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; 1796 scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
1625 1797
1626 if (scene.RegionInfo.Persistent) 1798 if (scene.RegionInfo.Persistent)
1627 scene.RegionInfo.EstateSettings.Save(); 1799 m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
1628 1800
1629 m_log.Info("[RADMIN]: Access List Clear Request complete"); 1801 m_log.Info("[RADMIN]: Access List Clear Request complete");
1630 } 1802 }
@@ -1670,7 +1842,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1670 } 1842 }
1671 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); 1843 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
1672 if (scene.RegionInfo.Persistent) 1844 if (scene.RegionInfo.Persistent)
1673 scene.RegionInfo.EstateSettings.Save(); 1845 m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
1674 } 1846 }
1675 1847
1676 responseData["added"] = addedUsers; 1848 responseData["added"] = addedUsers;
@@ -1719,7 +1891,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1719 } 1891 }
1720 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray(); 1892 scene.RegionInfo.EstateSettings.EstateAccess = accessControlList.ToArray();
1721 if (scene.RegionInfo.Persistent) 1893 if (scene.RegionInfo.Persistent)
1722 scene.RegionInfo.EstateSettings.Save(); 1894 m_application.EstateDataService.StoreEstateSettings(scene.RegionInfo.EstateSettings);
1723 } 1895 }
1724 1896
1725 responseData["removed"] = removedUsers; 1897 responseData["removed"] = removedUsers;
@@ -1759,6 +1931,87 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1759 m_log.Info("[RADMIN]: Access List List Request complete"); 1931 m_log.Info("[RADMIN]: Access List List Request complete");
1760 } 1932 }
1761 1933
1934 private void XmlRpcEstateReload(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1935 {
1936 m_log.Info("[RADMIN]: Received Estate Reload Request");
1937
1938 Hashtable responseData = (Hashtable)response.Value;
1939// Hashtable requestData = (Hashtable)request.Params[0];
1940
1941 m_application.SceneManager.ForEachScene(s =>
1942 s.RegionInfo.EstateSettings = m_application.EstateDataService.LoadEstateSettings(s.RegionInfo.RegionID, false)
1943 );
1944
1945 responseData["success"] = true;
1946
1947 m_log.Info("[RADMIN]: Estate Reload Request complete");
1948 }
1949
1950 private void XmlRpcGetAgentsMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1951 {
1952 Hashtable responseData = (Hashtable)response.Value;
1953 Hashtable requestData = (Hashtable)request.Params[0];
1954
1955 bool includeChildren = false;
1956
1957 if (requestData.Contains("include_children"))
1958 bool.TryParse((string)requestData["include_children"], out includeChildren);
1959
1960 Scene scene;
1961 GetSceneFromRegionParams(requestData, responseData, out scene);
1962
1963 ArrayList xmlRpcRegions = new ArrayList();
1964 responseData["regions"] = xmlRpcRegions;
1965
1966 Hashtable xmlRpcRegion = new Hashtable();
1967 xmlRpcRegions.Add(xmlRpcRegion);
1968
1969 xmlRpcRegion["name"] = scene.Name;
1970 xmlRpcRegion["id"] = scene.RegionInfo.RegionID.ToString();
1971
1972 List<ScenePresence> agents = scene.GetScenePresences();
1973 ArrayList xmlrpcAgents = new ArrayList();
1974
1975 foreach (ScenePresence agent in agents)
1976 {
1977 if (agent.IsChildAgent && !includeChildren)
1978 continue;
1979
1980 Hashtable xmlRpcAgent = new Hashtable();
1981 xmlRpcAgent.Add("name", agent.Name);
1982 xmlRpcAgent.Add("id", agent.UUID.ToString());
1983 xmlRpcAgent.Add("type", agent.PresenceType.ToString());
1984 xmlRpcAgent.Add("current_parcel_id", agent.currentParcelUUID.ToString());
1985
1986 Vector3 pos = agent.AbsolutePosition;
1987 xmlRpcAgent.Add("pos_x", pos.X.ToString());
1988 xmlRpcAgent.Add("pos_y", pos.Y.ToString());
1989 xmlRpcAgent.Add("pos_z", pos.Z.ToString());
1990
1991 Vector3 lookAt = agent.Lookat;
1992 xmlRpcAgent.Add("lookat_x", lookAt.X.ToString());
1993 xmlRpcAgent.Add("lookat_y", lookAt.Y.ToString());
1994 xmlRpcAgent.Add("lookat_z", lookAt.Z.ToString());
1995
1996 Vector3 vel = agent.Velocity;
1997 xmlRpcAgent.Add("vel_x", vel.X.ToString());
1998 xmlRpcAgent.Add("vel_y", vel.Y.ToString());
1999 xmlRpcAgent.Add("vel_z", vel.Z.ToString());
2000
2001 xmlRpcAgent.Add("is_flying", agent.Flying.ToString());
2002 xmlRpcAgent.Add("is_sat_on_ground", agent.SitGround.ToString());
2003 xmlRpcAgent.Add("is_sat_on_object", agent.IsSatOnObject.ToString());
2004
2005 xmlrpcAgents.Add(xmlRpcAgent);
2006 }
2007
2008 m_log.DebugFormat(
2009 "[REMOTE ADMIN]: XmlRpcGetAgents found {0} agents in {1}", xmlrpcAgents.Count, scene.Name);
2010
2011 xmlRpcRegion["agents"] = xmlrpcAgents;
2012 responseData["success"] = true;
2013 }
2014
1762 private void XmlRpcTeleportAgentMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 2015 private void XmlRpcTeleportAgentMethod(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
1763 { 2016 {
1764 Hashtable responseData = (Hashtable)response.Value; 2017 Hashtable responseData = (Hashtable)response.Value;
@@ -1814,6 +2067,56 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1814 responseData["success"] = true; 2067 responseData["success"] = true;
1815 } 2068 }
1816 2069
2070 private void XmlRpcResetLand(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2071 {
2072 Hashtable requestData = (Hashtable)request.Params[0];
2073 Hashtable responseData = (Hashtable)response.Value;
2074
2075 string musicURL = string.Empty;
2076 UUID groupID = UUID.Zero;
2077 uint flags = 0;
2078 bool set_group = false, set_music = false, set_flags = false;
2079
2080 if (requestData.Contains("group") && requestData["group"] != null)
2081 set_group = UUID.TryParse(requestData["group"].ToString(), out groupID);
2082 if (requestData.Contains("music") && requestData["music"] != null)
2083 {
2084 musicURL = requestData["music"].ToString();
2085 set_music = true;
2086 }
2087 if (requestData.Contains("flags") && requestData["flags"] != null)
2088 set_flags = UInt32.TryParse(requestData["flags"].ToString(), out flags);
2089
2090 m_log.InfoFormat("[RADMIN]: Received Reset Land Request group={0} musicURL={1} flags={2}",
2091 (set_group ? groupID.ToString() : "unchanged"),
2092 (set_music ? musicURL : "unchanged"),
2093 (set_flags ? flags.ToString() : "unchanged"));
2094
2095 m_application.SceneManager.ForEachScene(delegate(Scene s)
2096 {
2097 List<ILandObject> parcels = s.LandChannel.AllParcels();
2098 foreach (ILandObject p in parcels)
2099 {
2100 if (set_music)
2101 p.LandData.MusicURL = musicURL;
2102
2103 if (set_group)
2104 p.LandData.GroupID = groupID;
2105
2106 if (set_flags)
2107 p.LandData.Flags = flags;
2108
2109 s.LandChannel.UpdateLandObject(p.LandData.LocalID, p.LandData);
2110 }
2111 }
2112 );
2113
2114 responseData["success"] = true;
2115
2116 m_log.Info("[RADMIN]: Reset Land Request complete");
2117 }
2118
2119
1817 /// <summary> 2120 /// <summary>
1818 /// Parse a float with the given parameter name from a request data hash table. 2121 /// Parse a float with the given parameter name from a request data hash table.
1819 /// </summary> 2122 /// </summary>
@@ -1989,7 +2292,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1989 { 2292 {
1990 account.ServiceURLs = new Dictionary<string, object>(); 2293 account.ServiceURLs = new Dictionary<string, object>();
1991 account.ServiceURLs["HomeURI"] = string.Empty; 2294 account.ServiceURLs["HomeURI"] = string.Empty;
1992 account.ServiceURLs["GatekeeperURI"] = string.Empty;
1993 account.ServiceURLs["InventoryServerURI"] = string.Empty; 2295 account.ServiceURLs["InventoryServerURI"] = string.Empty;
1994 account.ServiceURLs["AssetServerURI"] = string.Empty; 2296 account.ServiceURLs["AssetServerURI"] = string.Empty;
1995 } 2297 }
@@ -2236,8 +2538,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2236 try 2538 try
2237 { 2539 {
2238 Dictionary<UUID,UUID> inventoryMap = new Dictionary<UUID,UUID>(); 2540 Dictionary<UUID,UUID> inventoryMap = new Dictionary<UUID,UUID>();
2239 CopyInventoryFolders(destination, source, AssetType.Clothing, inventoryMap, avatarAppearance); 2541 CopyInventoryFolders(destination, source, FolderType.Clothing, inventoryMap, avatarAppearance);
2240 CopyInventoryFolders(destination, source, AssetType.Bodypart, inventoryMap, avatarAppearance); 2542 CopyInventoryFolders(destination, source, FolderType.BodyPart, inventoryMap, avatarAppearance);
2241 2543
2242 AvatarWearable[] wearables = avatarAppearance.Wearables; 2544 AvatarWearable[] wearables = avatarAppearance.Wearables;
2243 2545
@@ -2273,20 +2575,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2273 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; 2575 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;
2274 2576
2275 // Get Clothing folder of receiver 2577 // Get Clothing folder of receiver
2276 InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing); 2578 InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, FolderType.Clothing);
2277 2579
2278 if (destinationFolder == null) 2580 if (destinationFolder == null)
2279 throw new Exception("Cannot locate folder(s)"); 2581 throw new Exception("Cannot locate folder(s)");
2280 2582
2281 // Missing destination folder? This should *never* be the case 2583 // Missing destination folder? This should *never* be the case
2282 if (destinationFolder.Type != (short)AssetType.Clothing) 2584 if (destinationFolder.Type != (short)FolderType.Clothing)
2283 { 2585 {
2284 destinationFolder = new InventoryFolderBase(); 2586 destinationFolder = new InventoryFolderBase();
2285 2587
2286 destinationFolder.ID = UUID.Random(); 2588 destinationFolder.ID = UUID.Random();
2287 destinationFolder.Name = "Clothing"; 2589 destinationFolder.Name = "Clothing";
2288 destinationFolder.Owner = destination; 2590 destinationFolder.Owner = destination;
2289 destinationFolder.Type = (short)AssetType.Clothing; 2591 destinationFolder.Type = (short)FolderType.Clothing;
2290 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; 2592 destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID;
2291 destinationFolder.Version = 1; 2593 destinationFolder.Version = 1;
2292 inventoryService.AddFolder(destinationFolder); // store base record 2594 inventoryService.AddFolder(destinationFolder); // store base record
@@ -2404,7 +2706,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2404 /// This method is called by establishAppearance to copy inventory folders to make 2706 /// This method is called by establishAppearance to copy inventory folders to make
2405 /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments 2707 /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments
2406 /// </summary> 2708 /// </summary>
2407 private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary<UUID,UUID> inventoryMap, 2709 private void CopyInventoryFolders(UUID destination, UUID source, FolderType assetType, Dictionary<UUID, UUID> inventoryMap,
2408 AvatarAppearance avatarAppearance) 2710 AvatarAppearance avatarAppearance)
2409 { 2711 {
2410 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; 2712 IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService;
@@ -2420,9 +2722,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2420 { 2722 {
2421 sourceFolder = new InventoryFolderBase(); 2723 sourceFolder = new InventoryFolderBase();
2422 sourceFolder.ID = UUID.Random(); 2724 sourceFolder.ID = UUID.Random();
2423 if (assetType == AssetType.Clothing) { 2725 if (assetType == FolderType.Clothing)
2726 {
2424 sourceFolder.Name = "Clothing"; 2727 sourceFolder.Name = "Clothing";
2425 } else { 2728 }
2729 else
2730 {
2426 sourceFolder.Name = "Body Parts"; 2731 sourceFolder.Name = "Body Parts";
2427 } 2732 }
2428 sourceFolder.Owner = source; 2733 sourceFolder.Owner = source;
@@ -2438,7 +2743,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2438 { 2743 {
2439 destinationFolder = new InventoryFolderBase(); 2744 destinationFolder = new InventoryFolderBase();
2440 destinationFolder.ID = UUID.Random(); 2745 destinationFolder.ID = UUID.Random();
2441 if (assetType == AssetType.Clothing) 2746 if (assetType == FolderType.Clothing)
2442 { 2747 {
2443 destinationFolder.Name = "Clothing"; 2748 destinationFolder.Name = "Clothing";
2444 } 2749 }
@@ -2517,15 +2822,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2517 /// </summary> 2822 /// </summary>
2518 private void ApplyNextOwnerPermissions(InventoryItemBase item) 2823 private void ApplyNextOwnerPermissions(InventoryItemBase item)
2519 { 2824 {
2520 if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) 2825 if (item.InvType == (int)InventoryType.Object)
2521 { 2826 {
2522 if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) 2827 uint perms = item.CurrentPermissions;
2523 item.CurrentPermissions &= ~(uint)PermissionMask.Copy; 2828 PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
2524 if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) 2829 item.CurrentPermissions = perms;
2525 item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
2526 if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
2527 item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
2528 } 2830 }
2831
2529 item.CurrentPermissions &= item.NextPermissions; 2832 item.CurrentPermissions &= item.NextPermissions;
2530 item.BasePermissions &= item.NextPermissions; 2833 item.BasePermissions &= item.NextPermissions;
2531 item.EveryOnePermissions &= item.NextPermissions; 2834 item.EveryOnePermissions &= item.NextPermissions;
@@ -2637,7 +2940,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2637 // Set home position 2940 // Set home position
2638 2941
2639 GridRegion home = scene.GridService.GetRegionByPosition(scopeID, 2942 GridRegion home = scene.GridService.GetRegionByPosition(scopeID,
2640 (int)(regionXLocation * Constants.RegionSize), (int)(regionYLocation * Constants.RegionSize)); 2943 (int)Util.RegionToWorldLoc(regionXLocation), (int)Util.RegionToWorldLoc(regionYLocation));
2641 if (null == home) { 2944 if (null == home) {
2642 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]); 2945 m_log.WarnFormat("[RADMIN]: Unable to set home region for newly created user account {0} {1}", names[0], names[1]);
2643 } else { 2946 } else {
@@ -2679,16 +2982,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2679 // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", 2982 // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory",
2680 // uic.folders.Count, uic.items.Count); 2983 // uic.folders.Count, uic.items.Count);
2681 2984
2682 InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, AssetType.Clothing); 2985 InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, FolderType.Clothing);
2683 2986
2684 // This should *never* be the case 2987 // This should *never* be the case
2685 if (clothingFolder == null || clothingFolder.Type != (short)AssetType.Clothing) 2988 if (clothingFolder == null || clothingFolder.Type != (short)FolderType.Clothing)
2686 { 2989 {
2687 clothingFolder = new InventoryFolderBase(); 2990 clothingFolder = new InventoryFolderBase();
2688 clothingFolder.ID = UUID.Random(); 2991 clothingFolder.ID = UUID.Random();
2689 clothingFolder.Name = "Clothing"; 2992 clothingFolder.Name = "Clothing";
2690 clothingFolder.Owner = ID; 2993 clothingFolder.Owner = ID;
2691 clothingFolder.Type = (short)AssetType.Clothing; 2994 clothingFolder.Type = (short)FolderType.Clothing;
2692 clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; 2995 clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID;
2693 clothingFolder.Version = 1; 2996 clothingFolder.Version = 1;
2694 inventoryService.AddFolder(clothingFolder); // store base record 2997 inventoryService.AddFolder(clothingFolder); // store base record
@@ -2734,7 +3037,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2734 extraFolder.ID = UUID.Random(); 3037 extraFolder.ID = UUID.Random();
2735 extraFolder.Name = outfitName; 3038 extraFolder.Name = outfitName;
2736 extraFolder.Owner = ID; 3039 extraFolder.Owner = ID;
2737 extraFolder.Type = (short)AssetType.Clothing; 3040 extraFolder.Type = (short)FolderType.Clothing;
2738 extraFolder.Version = 1; 3041 extraFolder.Version = 1;
2739 extraFolder.ParentID = clothingFolder.ID; 3042 extraFolder.ParentID = clothingFolder.ID;
2740 inventoryService.AddFolder(extraFolder); 3043 inventoryService.AddFolder(extraFolder);
diff --git a/OpenSim/ApplicationPlugins/RemoteController/Resources/RemoteAdminPlugin.addin.xml b/OpenSim/ApplicationPlugins/RemoteController/Resources/RemoteAdminPlugin.addin.xml
deleted file mode 100644
index d68f2e4..0000000
--- a/OpenSim/ApplicationPlugins/RemoteController/Resources/RemoteAdminPlugin.addin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
1<Addin id="OpenSim.ApplicationPlugins.RemoteController" version="0.1">
2 <Runtime>
3 <Import assembly="OpenSim.ApplicationPlugins.RemoteController.dll"/>
4 </Runtime>
5 <Dependencies>
6 <Addin id="OpenSim" version="0.5" />
7 </Dependencies>
8 <Extension path = "/OpenSim/Startup">
9 <Plugin id="RemoteController" type="OpenSim.ApplicationPlugins.RemoteController.RemoteAdminPlugin" />
10 </Extension>
11</Addin>