aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-06 22:29:27 +0000
committerJustin Clark-Casey (justincc)2012-01-06 22:29:27 +0000
commit3073370d0e1b2bca2f8b61d03824e8d39b674b04 (patch)
treea7aafc8f0e032272ed023281b5d76026d5582d1b
parenteliminate a few tabs from OpenSimDefaults.ini (diff)
downloadopensim-SC_OLD-3073370d0e1b2bca2f8b61d03824e8d39b674b04.zip
opensim-SC_OLD-3073370d0e1b2bca2f8b61d03824e8d39b674b04.tar.gz
opensim-SC_OLD-3073370d0e1b2bca2f8b61d03824e8d39b674b04.tar.bz2
opensim-SC_OLD-3073370d0e1b2bca2f8b61d03824e8d39b674b04.tar.xz
Allow RemoteAdmin to deal with all the different kinds of region id parameter that have been used in different methods.
See http://opensimulator.org/mantis/view.php?id=5814 Thanks Michelle Argus!
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs406
1 files changed, 191 insertions, 215 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 7106e6a..7f1a0ed 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -257,17 +257,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
257 { 257 {
258 m_log.Info("[RADMIN]: Request to restart Region."); 258 m_log.Info("[RADMIN]: Request to restart Region.");
259 259
260 CheckStringParameters(requestData, responseData, new string[] {"regionID"}); 260 CheckRegionParams(requestData, responseData);
261 261
262 UUID regionID = new UUID((string) requestData["regionID"]); 262 Scene rebootedScene = null;
263 263 GetSceneFromRegionParams(requestData, responseData, out rebootedScene);
264 Scene rebootedScene;
265 264
266 responseData["success"] = false; 265 responseData["success"] = false;
267 responseData["accepted"] = true; 266 responseData["accepted"] = true;
268 if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene))
269 throw new Exception("region not found");
270
271 responseData["rebooting"] = true; 267 responseData["rebooting"] = true;
272 268
273 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); 269 IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>();
@@ -329,14 +325,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
329 // } 325 // }
330 326
331 CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"}); 327 CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"});
328 CheckRegionParams(requestData, responseData);
332 329
333 string file = (string) requestData["filename"]; 330 Scene scene = null;
334 UUID regionID = (UUID) (string) requestData["regionid"]; 331 GetSceneFromRegionParams(requestData, responseData, out scene);
335 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); 332 string file = (string)requestData["filename"];
336 333
337 responseData["accepted"] = true; 334 responseData["accepted"] = true;
338 335
339 LoadHeightmap(file, regionID); 336 LoadHeightmap(file, scene.RegionInfo.RegionID);
340 337
341 responseData["success"] = true; 338 responseData["success"] = true;
342 339
@@ -353,18 +350,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
353// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); 350// m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString());
354 351
355 CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" }); 352 CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" });
353 CheckRegionParams(requestData, responseData);
354
355 Scene region = null;
356 GetSceneFromRegionParams(requestData, responseData, out region);
356 357
357 string file = (string)requestData["filename"]; 358 string file = (string)requestData["filename"];
358 UUID regionID = (UUID)(string)requestData["regionid"];
359 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); 359 m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file);
360 360
361 responseData["accepted"] = true; 361 responseData["accepted"] = true;
362 362
363 Scene region = null;
364
365 if (!m_application.SceneManager.TryGetScene(regionID, out region))
366 throw new Exception("1: unable to get a scene with that name");
367
368 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); 363 ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
369 if (null == terrainModule) throw new Exception("terrain module not available"); 364 if (null == terrainModule) throw new Exception("terrain module not available");
370 365
@@ -732,7 +727,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
732 727
733 responseData["success"] = true; 728 responseData["success"] = true;
734 responseData["region_name"] = region.RegionName; 729 responseData["region_name"] = region.RegionName;
735 responseData["region_uuid"] = region.RegionID.ToString(); 730 responseData["region_id"] = region.RegionID.ToString();
731 responseData["region_uuid"] = region.RegionID.ToString(); //Deprecate July 2012
736 732
737 m_log.Info("[RADMIN]: CreateRegion: request complete"); 733 m_log.Info("[RADMIN]: CreateRegion: request complete");
738 } 734 }
@@ -774,16 +770,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
774 lock (m_requestLock) 770 lock (m_requestLock)
775 { 771 {
776 CheckStringParameters(requestData, responseData, new string[] {"region_name"}); 772 CheckStringParameters(requestData, responseData, new string[] {"region_name"});
773 CheckRegionParams(requestData, responseData);
777 774
778 Scene scene = null; 775 Scene scene = null;
779 string regionName = (string) requestData["region_name"]; 776 GetSceneFromRegionParams(requestData, responseData, out scene);
780 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
781 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
782 777
783 m_application.RemoveRegion(scene, true); 778 m_application.RemoveRegion(scene, true);
784 779
785 responseData["success"] = true; 780 responseData["success"] = true;
786 responseData["region_name"] = regionName; 781 responseData["region_name"] = scene.RegionInfo.RegionName;
782 responseData["region_id"] = scene.RegionInfo.RegionID;
787 783
788 m_log.Info("[RADMIN]: DeleteRegion: request complete"); 784 m_log.Info("[RADMIN]: DeleteRegion: request complete");
789 } 785 }
@@ -823,44 +819,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
823 819
824 Hashtable responseData = (Hashtable)response.Value; 820 Hashtable responseData = (Hashtable)response.Value;
825 Hashtable requestData = (Hashtable)request.Params[0]; 821 Hashtable requestData = (Hashtable)request.Params[0];
826 Scene scene = null;
827 822
828 lock (m_requestLock) 823 lock (m_requestLock)
829 { 824 {
830 if (requestData.ContainsKey("region_id") && 825 CheckRegionParams(requestData, responseData);
831 !String.IsNullOrEmpty((string) requestData["region_id"]))
832 {
833 // Region specified by UUID
834 UUID regionID = (UUID) (string) requestData["region_id"];
835 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
836 throw new Exception(String.Format("region \"{0}\" does not exist", regionID));
837
838 m_application.CloseRegion(scene);
839 826
840 responseData["success"] = true; 827 Scene scene = null;
841 responseData["region_id"] = regionID; 828 GetSceneFromRegionParams(requestData, responseData, out scene);
842
843 response.Value = responseData;
844 }
845 else if (
846 requestData.ContainsKey("region_name")
847 && !String.IsNullOrEmpty((string) requestData["region_name"]))
848 {
849 // Region specified by name
850 829
851 string regionName = (string) requestData["region_name"]; 830 m_application.CloseRegion(scene);
852 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
853 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
854 831
855 m_application.CloseRegion(scene); 832 responseData["success"] = true;
833 responseData["region_name"] = scene.RegionInfo.RegionName;
834 responseData["region_id"] = scene.RegionInfo.RegionID;
856 835
857 responseData["success"] = true; 836 response.Value = responseData;
858 responseData["region_name"] = regionName;
859 }
860 else
861 {
862 throw new Exception("no region specified");
863 }
864 837
865 m_log.Info("[RADMIN]: CloseRegion: request complete"); 838 m_log.Info("[RADMIN]: CloseRegion: request complete");
866 } 839 }
@@ -907,12 +880,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
907 880
908 lock (m_requestLock) 881 lock (m_requestLock)
909 { 882 {
910 CheckStringParameters(requestData, responseData, new string[] {"region_name"}); 883 CheckRegionParams(requestData, responseData);
911 884
912 Scene scene = null; 885 Scene scene = null;
913 string regionName = (string) requestData["region_name"]; 886 GetSceneFromRegionParams(requestData, responseData, out scene);
914 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
915 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
916 887
917 // Modify access 888 // Modify access
918 scene.RegionInfo.EstateSettings.PublicAccess = 889 scene.RegionInfo.EstateSettings.PublicAccess =
@@ -942,7 +913,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
942 } 913 }
943 914
944 responseData["success"] = true; 915 responseData["success"] = true;
945 responseData["region_name"] = regionName; 916 responseData["region_name"] = scene.RegionInfo.RegionName;
917 responseData["region_id"] = scene.RegionInfo.RegionID;
946 918
947 m_log.Info("[RADMIN]: ModifyRegion: request complete"); 919 m_log.Info("[RADMIN]: ModifyRegion: request complete");
948 } 920 }
@@ -1338,22 +1310,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1338 try 1310 try
1339 { 1311 {
1340 CheckStringParameters(requestData, responseData, new string[] {"filename"}); 1312 CheckStringParameters(requestData, responseData, new string[] {"filename"});
1313 CheckRegionParams(requestData, responseData);
1341 1314
1342 string filename = (string) requestData["filename"];
1343 Scene scene = null; 1315 Scene scene = null;
1344 if (requestData.Contains("region_uuid")) 1316 GetSceneFromRegionParams(requestData, responseData, out scene);
1345 { 1317
1346 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 1318 string filename = (string) requestData["filename"];
1347 if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
1348 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1349 }
1350 else if (requestData.Contains("region_name"))
1351 {
1352 string region_name = (string) requestData["region_name"];
1353 if (!m_application.SceneManager.TryGetScene(region_name, out scene))
1354 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1355 }
1356 else throw new Exception("neither region_name nor region_uuid given");
1357 1319
1358 bool mergeOar = false; 1320 bool mergeOar = false;
1359 bool skipAssets = false; 1321 bool skipAssets = false;
@@ -1434,22 +1396,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1434 try 1396 try
1435 { 1397 {
1436 CheckStringParameters(requestData, responseData, new string[] {"filename"}); 1398 CheckStringParameters(requestData, responseData, new string[] {"filename"});
1399 CheckRegionParams(requestData, responseData);
1437 1400
1438 string filename = (string)requestData["filename"];
1439 Scene scene = null; 1401 Scene scene = null;
1440 if (requestData.Contains("region_uuid")) 1402 GetSceneFromRegionParams(requestData, responseData, out scene);
1441 { 1403
1442 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 1404 string filename = (string)requestData["filename"];
1443 if (!m_application.SceneManager.TryGetScene(region_uuid, out scene))
1444 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1445 }
1446 else if (requestData.Contains("region_name"))
1447 {
1448 string region_name = (string) requestData["region_name"];
1449 if (!m_application.SceneManager.TryGetScene(region_name, out scene))
1450 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1451 }
1452 else throw new Exception("neither region_name nor region_uuid given");
1453 1405
1454 Dictionary<string, object> options = new Dictionary<string, object>(); 1406 Dictionary<string, object> options = new Dictionary<string, object>();
1455 1407
@@ -1521,25 +1473,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1521 try 1473 try
1522 { 1474 {
1523 CheckStringParameters(requestData, responseData, new string[] {"filename"}); 1475 CheckStringParameters(requestData, responseData, new string[] {"filename"});
1476 CheckRegionParams(requestData, responseData);
1524 1477
1525 string filename = (string) requestData["filename"]; 1478 Scene scene = null;
1526 if (requestData.Contains("region_uuid")) 1479 GetSceneFromRegionParams(requestData, responseData, out scene);
1527 {
1528 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1529 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1530 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1531
1532 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1533 }
1534 else if (requestData.Contains("region_name"))
1535 {
1536 string region_name = (string) requestData["region_name"];
1537 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1538 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1539 1480
1540 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); 1481 string filename = (string) requestData["filename"];
1541 }
1542 else throw new Exception("neither region_name nor region_uuid given");
1543 1482
1544 responseData["switched"] = true; 1483 responseData["switched"] = true;
1545 1484
@@ -1587,23 +1526,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1587 try 1526 try
1588 { 1527 {
1589 CheckStringParameters(requestData, responseData, new string[] {"filename"}); 1528 CheckStringParameters(requestData, responseData, new string[] {"filename"});
1529 CheckRegionParams(requestData, responseData);
1530
1531 Scene scene = null;
1532 GetSceneFromRegionParams(requestData, responseData, out scene);
1590 1533
1591 string filename = (string) requestData["filename"]; 1534 string filename = (string) requestData["filename"];
1592 if (requestData.Contains("region_uuid"))
1593 {
1594 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1595 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1596 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1597 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1598 }
1599 else if (requestData.Contains("region_name"))
1600 {
1601 string region_name = (string) requestData["region_name"];
1602 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1603 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1604 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
1605 }
1606 else throw new Exception("neither region_name nor region_uuid given");
1607 1535
1608 responseData["switched"] = true; 1536 responseData["switched"] = true;
1609 1537
@@ -1647,33 +1575,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1647 Hashtable responseData = (Hashtable)response.Value; 1575 Hashtable responseData = (Hashtable)response.Value;
1648 Hashtable requestData = (Hashtable)request.Params[0]; 1576 Hashtable requestData = (Hashtable)request.Params[0];
1649 1577
1650 responseData["success"] = true; 1578 CheckRegionParams(requestData, responseData);
1651
1652 if (requestData.Contains("region_uuid"))
1653 {
1654 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1655 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1656 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1657
1658 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1659 }
1660 else if (requestData.Contains("region_name"))
1661 {
1662 string region_name = (string) requestData["region_name"];
1663 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1664 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1665 1579
1666 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); 1580 Scene scene = null;
1667 } 1581 GetSceneFromRegionParams(requestData, responseData, out scene);
1668 else
1669 {
1670 throw new Exception("neither region_name nor region_uuid given");
1671 }
1672 1582
1673 Scene scene = m_application.SceneManager.CurrentScene;
1674 int health = scene.GetHealth(); 1583 int health = scene.GetHealth();
1675 responseData["health"] = health; 1584 responseData["health"] = health;
1676 1585
1586 responseData["success"] = true;
1677 m_log.Info("[RADMIN]: Query XML Administrator Request complete"); 1587 m_log.Info("[RADMIN]: Query XML Administrator Request complete");
1678 } 1588 }
1679 1589
@@ -1700,24 +1610,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1700 1610
1701 responseData["success"] = true; 1611 responseData["success"] = true;
1702 1612
1703 if (requestData.Contains("region_uuid")) 1613 CheckRegionParams(requestData, responseData);
1704 {
1705 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1706 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1707 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1708 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1709 }
1710 else if (requestData.Contains("region_name"))
1711 {
1712 string region_name = (string) requestData["region_name"];
1713 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1714 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1715 1614
1716 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); 1615 Scene scene = null;
1717 } 1616 GetSceneFromRegionParams(requestData, responseData, out scene);
1718 else throw new Exception("neither region_name nor region_uuid given");
1719 1617
1720 Scene scene = m_application.SceneManager.CurrentScene;
1721 scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; 1618 scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
1722 1619
1723 if (scene.RegionInfo.Persistent) 1620 if (scene.RegionInfo.Persistent)
@@ -1733,32 +1630,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1733 Hashtable responseData = (Hashtable)response.Value; 1630 Hashtable responseData = (Hashtable)response.Value;
1734 Hashtable requestData = (Hashtable)request.Params[0]; 1631 Hashtable requestData = (Hashtable)request.Params[0];
1735 1632
1736 if (requestData.Contains("region_uuid")) 1633 CheckRegionParams(requestData, responseData);
1737 { 1634
1738 UUID region_uuid = (UUID) (string) requestData["region_uuid"]; 1635 Scene scene = null;
1739 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) 1636 GetSceneFromRegionParams(requestData, responseData, out scene);
1740 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1741 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1742 }
1743 else if (requestData.Contains("region_name"))
1744 {
1745 string region_name = (string) requestData["region_name"];
1746 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1747 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1748 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
1749 }
1750 else
1751 {
1752 throw new Exception("neither region_name nor region_uuid given");
1753 }
1754 1637
1755 int addedUsers = 0; 1638 int addedUsers = 0;
1756 1639
1757 if (requestData.Contains("users")) 1640 if (requestData.Contains("users"))
1758 { 1641 {
1759 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 1642 UUID scopeID = scene.RegionInfo.ScopeID;
1760 IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; 1643 IUserAccountService userService = scene.UserAccountService;
1761 Scene scene = m_application.SceneManager.CurrentScene;
1762 Hashtable users = (Hashtable) requestData["users"]; 1644 Hashtable users = (Hashtable) requestData["users"];
1763 List<UUID> uuids = new List<UUID>(); 1645 List<UUID> uuids = new List<UUID>();
1764 foreach (string name in users.Values) 1646 foreach (string name in users.Values)
@@ -1797,32 +1679,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1797 Hashtable responseData = (Hashtable)response.Value; 1679 Hashtable responseData = (Hashtable)response.Value;
1798 Hashtable requestData = (Hashtable)request.Params[0]; 1680 Hashtable requestData = (Hashtable)request.Params[0];
1799 1681
1800 responseData["success"] = true; 1682 CheckRegionParams(requestData, responseData);
1801 1683
1802 if (requestData.Contains("region_uuid")) 1684 Scene scene = null;
1803 { 1685 GetSceneFromRegionParams(requestData, responseData, out scene);
1804 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1805 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1806 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1807 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1808 }
1809 else if (requestData.Contains("region_name"))
1810 {
1811 string region_name = (string) requestData["region_name"];
1812 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1813 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1814 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
1815 }
1816 else throw new Exception("neither region_name nor region_uuid given");
1817 1686
1818 int removedUsers = 0; 1687 int removedUsers = 0;
1819 1688
1820 if (requestData.Contains("users")) 1689 if (requestData.Contains("users"))
1821 { 1690 {
1822 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 1691 UUID scopeID = scene.RegionInfo.ScopeID;
1823 IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; 1692 IUserAccountService userService = scene.UserAccountService;
1824 //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService; 1693 //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService;
1825 Scene scene = m_application.SceneManager.CurrentScene;
1826 Hashtable users = (Hashtable) requestData["users"]; 1694 Hashtable users = (Hashtable) requestData["users"];
1827 List<UUID> uuids = new List<UUID>(); 1695 List<UUID> uuids = new List<UUID>();
1828 foreach (string name in users.Values) 1696 foreach (string name in users.Values)
@@ -1849,6 +1717,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1849 } 1717 }
1850 1718
1851 responseData["removed"] = removedUsers; 1719 responseData["removed"] = removedUsers;
1720 responseData["success"] = true;
1852 1721
1853 m_log.Info("[RADMIN]: Access List Remove Request complete"); 1722 m_log.Info("[RADMIN]: Access List Remove Request complete");
1854 } 1723 }
@@ -1860,32 +1729,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1860 Hashtable responseData = (Hashtable)response.Value; 1729 Hashtable responseData = (Hashtable)response.Value;
1861 Hashtable requestData = (Hashtable)request.Params[0]; 1730 Hashtable requestData = (Hashtable)request.Params[0];
1862 1731
1863 responseData["success"] = true; 1732 CheckRegionParams(requestData, responseData);
1864 1733
1865 if (requestData.Contains("region_uuid")) 1734 Scene scene = null;
1866 { 1735 GetSceneFromRegionParams(requestData, responseData, out scene);
1867 UUID region_uuid = (UUID) (string) requestData["region_uuid"];
1868 if (!m_application.SceneManager.TrySetCurrentScene(region_uuid))
1869 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
1870 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString());
1871 }
1872 else if (requestData.Contains("region_name"))
1873 {
1874 string region_name = (string) requestData["region_name"];
1875 if (!m_application.SceneManager.TrySetCurrentScene(region_name))
1876 throw new Exception(String.Format("failed to switch to region {0}", region_name));
1877 m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name);
1878 }
1879 else throw new Exception("neither region_name nor region_uuid given");
1880 1736
1881 Scene scene = m_application.SceneManager.CurrentScene;
1882 UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess; 1737 UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess;
1883 Hashtable users = new Hashtable(); 1738 Hashtable users = new Hashtable();
1884 1739
1885 foreach (UUID user in accessControlList) 1740 foreach (UUID user in accessControlList)
1886 { 1741 {
1887 UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; 1742 UUID scopeID = scene.RegionInfo.ScopeID;
1888 UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); 1743 UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, user);
1889 if (account != null) 1744 if (account != null)
1890 { 1745 {
1891 users[user.ToString()] = account.FirstName + " " + account.LastName; 1746 users[user.ToString()] = account.FirstName + " " + account.LastName;
@@ -1893,6 +1748,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1893 } 1748 }
1894 1749
1895 responseData["users"] = users; 1750 responseData["users"] = users;
1751 responseData["success"] = true;
1896 1752
1897 m_log.Info("[RADMIN]: Access List List Request complete"); 1753 m_log.Info("[RADMIN]: Access List List Request complete");
1898 } 1754 }
@@ -2010,6 +1866,126 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2010 } 1866 }
2011 } 1867 }
2012 1868
1869 private void CheckRegionParams(Hashtable requestData, Hashtable responseData)
1870 {
1871 //Checks if region parameters exist and gives exeption if no parameters are given
1872 if ((requestData.ContainsKey("region_id") && !String.IsNullOrEmpty((string)requestData["region_id"])) ||
1873 (requestData.ContainsKey("region_name") && !String.IsNullOrEmpty((string)requestData["region_name"])))
1874 {
1875 return;
1876 }
1877 #region Deprecate July 2012
1878 //region_ID, regionid, region_uuid will be deprecated in July 2012!!!!!!
1879 else if (requestData.ContainsKey("regionid") &&
1880 !String.IsNullOrEmpty((string)requestData["regionid"]))
1881 {
1882 m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
1883 }
1884 else if (requestData.ContainsKey("region_ID") &&
1885 !String.IsNullOrEmpty((string)requestData["region_ID"]))
1886 {
1887 m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
1888 }
1889 else if (requestData.ContainsKey("regionID") &&
1890 !String.IsNullOrEmpty((string)requestData["regionID"]))
1891 {
1892 m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
1893 }
1894 else if (requestData.ContainsKey("region_uuid") &&
1895 !String.IsNullOrEmpty((string)requestData["region_uuid"]))
1896 {
1897 m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
1898 }
1899 #endregion
1900 else
1901 {
1902 responseData["accepted"] = false;
1903 throw new Exception("no region_name or region_id given");
1904 }
1905 }
1906
1907 private void GetSceneFromRegionParams(Hashtable requestData, Hashtable responseData, out Scene scene)
1908 {
1909 scene = null;
1910
1911 if (requestData.ContainsKey("region_id") &&
1912 !String.IsNullOrEmpty((string)requestData["region_id"]))
1913 {
1914 UUID regionID = (UUID)(string)requestData["region_id"];
1915 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
1916 {
1917 responseData["error"] = String.Format("Region ID {0} not found", regionID);
1918 throw new Exception(String.Format("Region ID {0} not found", regionID));
1919 }
1920 }
1921 #region Deprecate July 2012
1922 else if (requestData.ContainsKey("regionid") &&
1923 !String.IsNullOrEmpty((string)requestData["regionid"]))
1924 {
1925 m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead");
1926
1927 UUID regionID = (UUID)(string)requestData["regionid"];
1928 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
1929 {
1930 responseData["error"] = String.Format("Region ID {0} not found", regionID);
1931 throw new Exception(String.Format("Region ID {0} not found", regionID));
1932 }
1933 }
1934 else if (requestData.ContainsKey("region_ID") &&
1935 !String.IsNullOrEmpty((string)requestData["region_ID"]))
1936 {
1937 m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead");
1938
1939 UUID regionID = (UUID)(string)requestData["region_ID"];
1940 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
1941 {
1942 responseData["error"] = String.Format("Region ID {0} not found", regionID);
1943 throw new Exception(String.Format("Region ID {0} not found", regionID));
1944 }
1945 }
1946 else if (requestData.ContainsKey("regionID") &&
1947 !String.IsNullOrEmpty((string)requestData["regionID"]))
1948 {
1949 m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead");
1950
1951 UUID regionID = (UUID)(string)requestData["regionID"];
1952 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
1953 {
1954 responseData["error"] = String.Format("Region ID {0} not found", regionID);
1955 throw new Exception(String.Format("Region ID {0} not found", regionID));
1956 }
1957 }
1958 else if (requestData.ContainsKey("region_uuid") &&
1959 !String.IsNullOrEmpty((string)requestData["region_uuid"]))
1960 {
1961 m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead");
1962
1963 UUID regionID = (UUID)(string)requestData["region_uuid"];
1964 if (!m_application.SceneManager.TryGetScene(regionID, out scene))
1965 {
1966 responseData["error"] = String.Format("Region ID {0} not found", regionID);
1967 throw new Exception(String.Format("Region ID {0} not found", regionID));
1968 }
1969 }
1970 #endregion
1971 else if (requestData.ContainsKey("region_name") &&
1972 !String.IsNullOrEmpty((string)requestData["region_name"]))
1973 {
1974 string regionName = (string)requestData["region_name"];
1975 if (!m_application.SceneManager.TryGetScene(regionName, out scene))
1976 {
1977 responseData["error"] = String.Format("Region {0} not found", regionName);
1978 throw new Exception(String.Format("Region {0} not found", regionName));
1979 }
1980 }
1981 else
1982 {
1983 responseData["error"] = "no region_name or region_id given";
1984 throw new Exception("no region_name or region_id given");
1985 }
1986 return;
1987 }
1988
2013 private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue) 1989 private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue)
2014 { 1990 {
2015 // If an access value has been provided, apply it. 1991 // If an access value has been provided, apply it.