diff options
author | Melanie | 2012-01-06 22:41:26 +0000 |
---|---|---|
committer | Melanie | 2012-01-06 22:41:26 +0000 |
commit | a34278cfc3371c7bcbc6f307d92b597e85782f99 (patch) | |
tree | 0e9a82d51f64402fb127778323a89f134f623265 /OpenSim/ApplicationPlugins | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-a34278cfc3371c7bcbc6f307d92b597e85782f99.zip opensim-SC-a34278cfc3371c7bcbc6f307d92b597e85782f99.tar.gz opensim-SC-a34278cfc3371c7bcbc6f307d92b597e85782f99.tar.bz2 opensim-SC-a34278cfc3371c7bcbc6f307d92b597e85782f99.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 400 |
1 files changed, 190 insertions, 210 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index d26a1bd..dcc88c4 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -258,17 +258,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
258 | { | 258 | { |
259 | m_log.Info("[RADMIN]: Request to restart Region."); | 259 | m_log.Info("[RADMIN]: Request to restart Region."); |
260 | 260 | ||
261 | CheckStringParameters(requestData, responseData, new string[] {"regionID"}); | 261 | CheckRegionParams(requestData, responseData); |
262 | 262 | ||
263 | UUID regionID = new UUID((string) requestData["regionID"]); | 263 | Scene rebootedScene = null; |
264 | 264 | GetSceneFromRegionParams(requestData, responseData, out rebootedScene); | |
265 | Scene rebootedScene; | ||
266 | 265 | ||
267 | responseData["success"] = false; | 266 | responseData["success"] = false; |
268 | responseData["accepted"] = true; | 267 | responseData["accepted"] = true; |
269 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) | ||
270 | throw new Exception("region not found"); | ||
271 | |||
272 | responseData["rebooting"] = true; | 268 | responseData["rebooting"] = true; |
273 | 269 | ||
274 | string message; | 270 | string message; |
@@ -392,14 +388,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
392 | // } | 388 | // } |
393 | 389 | ||
394 | CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"}); | 390 | CheckStringParameters(requestData, responseData, new string[] {"filename", "regionid"}); |
391 | CheckRegionParams(requestData, responseData); | ||
395 | 392 | ||
396 | string file = (string) requestData["filename"]; | 393 | Scene scene = null; |
397 | UUID regionID = (UUID) (string) requestData["regionid"]; | 394 | GetSceneFromRegionParams(requestData, responseData, out scene); |
398 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); | 395 | string file = (string)requestData["filename"]; |
399 | 396 | ||
400 | responseData["accepted"] = true; | 397 | responseData["accepted"] = true; |
401 | 398 | ||
402 | LoadHeightmap(file, regionID); | 399 | LoadHeightmap(file, scene.RegionInfo.RegionID); |
403 | 400 | ||
404 | responseData["success"] = true; | 401 | responseData["success"] = true; |
405 | 402 | ||
@@ -416,18 +413,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
416 | // m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); | 413 | // m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); |
417 | 414 | ||
418 | CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" }); | 415 | CheckStringParameters(requestData, responseData, new string[] { "filename", "regionid" }); |
416 | CheckRegionParams(requestData, responseData); | ||
417 | |||
418 | Scene region = null; | ||
419 | GetSceneFromRegionParams(requestData, responseData, out region); | ||
419 | 420 | ||
420 | string file = (string)requestData["filename"]; | 421 | string file = (string)requestData["filename"]; |
421 | UUID regionID = (UUID)(string)requestData["regionid"]; | ||
422 | m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); | 422 | m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); |
423 | 423 | ||
424 | responseData["accepted"] = true; | 424 | responseData["accepted"] = true; |
425 | 425 | ||
426 | Scene region = null; | ||
427 | |||
428 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
429 | throw new Exception("1: unable to get a scene with that name"); | ||
430 | |||
431 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | 426 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); |
432 | if (null == terrainModule) throw new Exception("terrain module not available"); | 427 | if (null == terrainModule) throw new Exception("terrain module not available"); |
433 | 428 | ||
@@ -814,7 +809,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
814 | 809 | ||
815 | responseData["success"] = true; | 810 | responseData["success"] = true; |
816 | responseData["region_name"] = region.RegionName; | 811 | responseData["region_name"] = region.RegionName; |
817 | responseData["region_uuid"] = region.RegionID.ToString(); | 812 | responseData["region_id"] = region.RegionID.ToString(); |
813 | responseData["region_uuid"] = region.RegionID.ToString(); //Deprecate July 2012 | ||
818 | 814 | ||
819 | m_log.Info("[RADMIN]: CreateRegion: request complete"); | 815 | m_log.Info("[RADMIN]: CreateRegion: request complete"); |
820 | } | 816 | } |
@@ -856,16 +852,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
856 | lock (m_requestLock) | 852 | lock (m_requestLock) |
857 | { | 853 | { |
858 | CheckStringParameters(requestData, responseData, new string[] {"region_name"}); | 854 | CheckStringParameters(requestData, responseData, new string[] {"region_name"}); |
855 | CheckRegionParams(requestData, responseData); | ||
859 | 856 | ||
860 | Scene scene = null; | 857 | Scene scene = null; |
861 | string regionName = (string) requestData["region_name"]; | 858 | GetSceneFromRegionParams(requestData, responseData, out scene); |
862 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | ||
863 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | ||
864 | 859 | ||
865 | m_application.RemoveRegion(scene, true); | 860 | m_application.RemoveRegion(scene, true); |
866 | 861 | ||
867 | responseData["success"] = true; | 862 | responseData["success"] = true; |
868 | responseData["region_name"] = regionName; | 863 | responseData["region_name"] = scene.RegionInfo.RegionName; |
864 | responseData["region_id"] = scene.RegionInfo.RegionID; | ||
869 | 865 | ||
870 | m_log.Info("[RADMIN]: DeleteRegion: request complete"); | 866 | m_log.Info("[RADMIN]: DeleteRegion: request complete"); |
871 | } | 867 | } |
@@ -905,44 +901,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
905 | 901 | ||
906 | Hashtable responseData = (Hashtable)response.Value; | 902 | Hashtable responseData = (Hashtable)response.Value; |
907 | Hashtable requestData = (Hashtable)request.Params[0]; | 903 | Hashtable requestData = (Hashtable)request.Params[0]; |
908 | Scene scene = null; | ||
909 | 904 | ||
910 | lock (m_requestLock) | 905 | lock (m_requestLock) |
911 | { | 906 | { |
912 | if (requestData.ContainsKey("region_id") && | 907 | CheckRegionParams(requestData, responseData); |
913 | !String.IsNullOrEmpty((string) requestData["region_id"])) | ||
914 | { | ||
915 | // Region specified by UUID | ||
916 | UUID regionID = (UUID) (string) requestData["region_id"]; | ||
917 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
918 | throw new Exception(String.Format("region \"{0}\" does not exist", regionID)); | ||
919 | |||
920 | m_application.CloseRegion(scene); | ||
921 | |||
922 | responseData["success"] = true; | ||
923 | responseData["region_id"] = regionID; | ||
924 | 908 | ||
925 | response.Value = responseData; | 909 | Scene scene = null; |
926 | } | 910 | GetSceneFromRegionParams(requestData, responseData, out scene); |
927 | else if ( | ||
928 | requestData.ContainsKey("region_name") | ||
929 | && !String.IsNullOrEmpty((string) requestData["region_name"])) | ||
930 | { | ||
931 | // Region specified by name | ||
932 | 911 | ||
933 | string regionName = (string) requestData["region_name"]; | 912 | m_application.CloseRegion(scene); |
934 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | ||
935 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | ||
936 | 913 | ||
937 | m_application.CloseRegion(scene); | 914 | responseData["success"] = true; |
915 | responseData["region_name"] = scene.RegionInfo.RegionName; | ||
916 | responseData["region_id"] = scene.RegionInfo.RegionID; | ||
938 | 917 | ||
939 | responseData["success"] = true; | 918 | response.Value = responseData; |
940 | responseData["region_name"] = regionName; | ||
941 | } | ||
942 | else | ||
943 | { | ||
944 | throw new Exception("no region specified"); | ||
945 | } | ||
946 | 919 | ||
947 | m_log.Info("[RADMIN]: CloseRegion: request complete"); | 920 | m_log.Info("[RADMIN]: CloseRegion: request complete"); |
948 | } | 921 | } |
@@ -989,12 +962,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
989 | 962 | ||
990 | lock (m_requestLock) | 963 | lock (m_requestLock) |
991 | { | 964 | { |
992 | CheckStringParameters(requestData, responseData, new string[] {"region_name"}); | 965 | CheckRegionParams(requestData, responseData); |
993 | 966 | ||
994 | Scene scene = null; | 967 | Scene scene = null; |
995 | string regionName = (string) requestData["region_name"]; | 968 | GetSceneFromRegionParams(requestData, responseData, out scene); |
996 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | ||
997 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | ||
998 | 969 | ||
999 | // Modify access | 970 | // Modify access |
1000 | scene.RegionInfo.EstateSettings.PublicAccess = | 971 | scene.RegionInfo.EstateSettings.PublicAccess = |
@@ -1024,7 +995,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1024 | } | 995 | } |
1025 | 996 | ||
1026 | responseData["success"] = true; | 997 | responseData["success"] = true; |
1027 | responseData["region_name"] = regionName; | 998 | responseData["region_name"] = scene.RegionInfo.RegionName; |
999 | responseData["region_id"] = scene.RegionInfo.RegionID; | ||
1028 | 1000 | ||
1029 | m_log.Info("[RADMIN]: ModifyRegion: request complete"); | 1001 | m_log.Info("[RADMIN]: ModifyRegion: request complete"); |
1030 | } | 1002 | } |
@@ -1420,22 +1392,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1420 | try | 1392 | try |
1421 | { | 1393 | { |
1422 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); | 1394 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); |
1395 | CheckRegionParams(requestData, responseData); | ||
1423 | 1396 | ||
1424 | string filename = (string) requestData["filename"]; | ||
1425 | Scene scene = null; | 1397 | Scene scene = null; |
1426 | if (requestData.Contains("region_uuid")) | 1398 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1427 | { | 1399 | |
1428 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 1400 | string filename = (string) requestData["filename"]; |
1429 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) | ||
1430 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1431 | } | ||
1432 | else if (requestData.Contains("region_name")) | ||
1433 | { | ||
1434 | string region_name = (string) requestData["region_name"]; | ||
1435 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) | ||
1436 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1437 | } | ||
1438 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1439 | 1401 | ||
1440 | bool mergeOar = false; | 1402 | bool mergeOar = false; |
1441 | bool skipAssets = false; | 1403 | bool skipAssets = false; |
@@ -1516,22 +1478,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1516 | try | 1478 | try |
1517 | { | 1479 | { |
1518 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); | 1480 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); |
1481 | CheckRegionParams(requestData, responseData); | ||
1519 | 1482 | ||
1520 | string filename = (string)requestData["filename"]; | ||
1521 | Scene scene = null; | 1483 | Scene scene = null; |
1522 | if (requestData.Contains("region_uuid")) | 1484 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1523 | { | 1485 | |
1524 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 1486 | string filename = (string)requestData["filename"]; |
1525 | if (!m_application.SceneManager.TryGetScene(region_uuid, out scene)) | ||
1526 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1527 | } | ||
1528 | else if (requestData.Contains("region_name")) | ||
1529 | { | ||
1530 | string region_name = (string) requestData["region_name"]; | ||
1531 | if (!m_application.SceneManager.TryGetScene(region_name, out scene)) | ||
1532 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1533 | } | ||
1534 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1535 | 1487 | ||
1536 | Dictionary<string, object> options = new Dictionary<string, object>(); | 1488 | Dictionary<string, object> options = new Dictionary<string, object>(); |
1537 | 1489 | ||
@@ -1603,25 +1555,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1603 | try | 1555 | try |
1604 | { | 1556 | { |
1605 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); | 1557 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); |
1558 | CheckRegionParams(requestData, responseData); | ||
1606 | 1559 | ||
1607 | string filename = (string) requestData["filename"]; | 1560 | Scene scene = null; |
1608 | if (requestData.Contains("region_uuid")) | 1561 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1609 | { | ||
1610 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1611 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1612 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1613 | |||
1614 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1615 | } | ||
1616 | else if (requestData.Contains("region_name")) | ||
1617 | { | ||
1618 | string region_name = (string) requestData["region_name"]; | ||
1619 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1620 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1621 | 1562 | ||
1622 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | 1563 | string filename = (string) requestData["filename"]; |
1623 | } | ||
1624 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1625 | 1564 | ||
1626 | responseData["switched"] = true; | 1565 | responseData["switched"] = true; |
1627 | 1566 | ||
@@ -1669,23 +1608,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1669 | try | 1608 | try |
1670 | { | 1609 | { |
1671 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); | 1610 | CheckStringParameters(requestData, responseData, new string[] {"filename"}); |
1611 | CheckRegionParams(requestData, responseData); | ||
1612 | |||
1613 | Scene scene = null; | ||
1614 | GetSceneFromRegionParams(requestData, responseData, out scene); | ||
1672 | 1615 | ||
1673 | string filename = (string) requestData["filename"]; | 1616 | string filename = (string) requestData["filename"]; |
1674 | if (requestData.Contains("region_uuid")) | ||
1675 | { | ||
1676 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1677 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1678 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1679 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1680 | } | ||
1681 | else if (requestData.Contains("region_name")) | ||
1682 | { | ||
1683 | string region_name = (string) requestData["region_name"]; | ||
1684 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1685 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1686 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | ||
1687 | } | ||
1688 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1689 | 1617 | ||
1690 | responseData["switched"] = true; | 1618 | responseData["switched"] = true; |
1691 | 1619 | ||
@@ -1729,24 +1657,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1729 | 1657 | ||
1730 | responseData["success"] = true; | 1658 | responseData["success"] = true; |
1731 | 1659 | ||
1732 | if (requestData.Contains("region_uuid")) | 1660 | CheckRegionParams(requestData, responseData); |
1733 | { | ||
1734 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1735 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1736 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1737 | } | ||
1738 | else if (requestData.Contains("region_name")) | ||
1739 | { | ||
1740 | string region_name = (string) requestData["region_name"]; | ||
1741 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1742 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1743 | } | ||
1744 | else | ||
1745 | { | ||
1746 | throw new Exception("neither region_name nor region_uuid given"); | ||
1747 | } | ||
1748 | 1661 | ||
1749 | Scene scene = m_application.SceneManager.CurrentScene; | 1662 | Scene scene = null; |
1663 | GetSceneFromRegionParams(requestData, responseData, out scene); | ||
1750 | 1664 | ||
1751 | int flags; | 1665 | int flags; |
1752 | string text; | 1666 | string text; |
@@ -1779,24 +1693,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1779 | 1693 | ||
1780 | responseData["success"] = true; | 1694 | responseData["success"] = true; |
1781 | 1695 | ||
1782 | if (requestData.Contains("region_uuid")) | 1696 | CheckRegionParams(requestData, responseData); |
1783 | { | ||
1784 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1785 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1786 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1787 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1788 | } | ||
1789 | else if (requestData.Contains("region_name")) | ||
1790 | { | ||
1791 | string region_name = (string) requestData["region_name"]; | ||
1792 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1793 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1794 | 1697 | ||
1795 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | 1698 | Scene scene = null; |
1796 | } | 1699 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1797 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1798 | 1700 | ||
1799 | Scene scene = m_application.SceneManager.CurrentScene; | ||
1800 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; | 1701 | scene.RegionInfo.EstateSettings.EstateAccess = new UUID[]{}; |
1801 | 1702 | ||
1802 | if (scene.RegionInfo.Persistent) | 1703 | if (scene.RegionInfo.Persistent) |
@@ -1812,32 +1713,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1812 | Hashtable responseData = (Hashtable)response.Value; | 1713 | Hashtable responseData = (Hashtable)response.Value; |
1813 | Hashtable requestData = (Hashtable)request.Params[0]; | 1714 | Hashtable requestData = (Hashtable)request.Params[0]; |
1814 | 1715 | ||
1815 | if (requestData.Contains("region_uuid")) | 1716 | CheckRegionParams(requestData, responseData); |
1816 | { | 1717 | |
1817 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | 1718 | Scene scene = null; |
1818 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | 1719 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1819 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1820 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1821 | } | ||
1822 | else if (requestData.Contains("region_name")) | ||
1823 | { | ||
1824 | string region_name = (string) requestData["region_name"]; | ||
1825 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1826 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1827 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | ||
1828 | } | ||
1829 | else | ||
1830 | { | ||
1831 | throw new Exception("neither region_name nor region_uuid given"); | ||
1832 | } | ||
1833 | 1720 | ||
1834 | int addedUsers = 0; | 1721 | int addedUsers = 0; |
1835 | 1722 | ||
1836 | if (requestData.Contains("users")) | 1723 | if (requestData.Contains("users")) |
1837 | { | 1724 | { |
1838 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1725 | UUID scopeID = scene.RegionInfo.ScopeID; |
1839 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; | 1726 | IUserAccountService userService = scene.UserAccountService; |
1840 | Scene scene = m_application.SceneManager.CurrentScene; | ||
1841 | Hashtable users = (Hashtable) requestData["users"]; | 1727 | Hashtable users = (Hashtable) requestData["users"]; |
1842 | List<UUID> uuids = new List<UUID>(); | 1728 | List<UUID> uuids = new List<UUID>(); |
1843 | foreach (string name in users.Values) | 1729 | foreach (string name in users.Values) |
@@ -1876,32 +1762,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1876 | Hashtable responseData = (Hashtable)response.Value; | 1762 | Hashtable responseData = (Hashtable)response.Value; |
1877 | Hashtable requestData = (Hashtable)request.Params[0]; | 1763 | Hashtable requestData = (Hashtable)request.Params[0]; |
1878 | 1764 | ||
1879 | responseData["success"] = true; | 1765 | CheckRegionParams(requestData, responseData); |
1880 | 1766 | ||
1881 | if (requestData.Contains("region_uuid")) | 1767 | Scene scene = null; |
1882 | { | 1768 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1883 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1884 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1885 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1886 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1887 | } | ||
1888 | else if (requestData.Contains("region_name")) | ||
1889 | { | ||
1890 | string region_name = (string) requestData["region_name"]; | ||
1891 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1892 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1893 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | ||
1894 | } | ||
1895 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1896 | 1769 | ||
1897 | int removedUsers = 0; | 1770 | int removedUsers = 0; |
1898 | 1771 | ||
1899 | if (requestData.Contains("users")) | 1772 | if (requestData.Contains("users")) |
1900 | { | 1773 | { |
1901 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1774 | UUID scopeID = scene.RegionInfo.ScopeID; |
1902 | IUserAccountService userService = m_application.SceneManager.CurrentOrFirstScene.UserAccountService; | 1775 | IUserAccountService userService = scene.UserAccountService; |
1903 | //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService; | 1776 | //UserProfileCacheService ups = m_application.CommunicationsManager.UserProfileCacheService; |
1904 | Scene scene = m_application.SceneManager.CurrentScene; | ||
1905 | Hashtable users = (Hashtable) requestData["users"]; | 1777 | Hashtable users = (Hashtable) requestData["users"]; |
1906 | List<UUID> uuids = new List<UUID>(); | 1778 | List<UUID> uuids = new List<UUID>(); |
1907 | foreach (string name in users.Values) | 1779 | foreach (string name in users.Values) |
@@ -1928,6 +1800,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1928 | } | 1800 | } |
1929 | 1801 | ||
1930 | responseData["removed"] = removedUsers; | 1802 | responseData["removed"] = removedUsers; |
1803 | responseData["success"] = true; | ||
1931 | 1804 | ||
1932 | m_log.Info("[RADMIN]: Access List Remove Request complete"); | 1805 | m_log.Info("[RADMIN]: Access List Remove Request complete"); |
1933 | } | 1806 | } |
@@ -1939,32 +1812,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1939 | Hashtable responseData = (Hashtable)response.Value; | 1812 | Hashtable responseData = (Hashtable)response.Value; |
1940 | Hashtable requestData = (Hashtable)request.Params[0]; | 1813 | Hashtable requestData = (Hashtable)request.Params[0]; |
1941 | 1814 | ||
1942 | responseData["success"] = true; | 1815 | CheckRegionParams(requestData, responseData); |
1943 | 1816 | ||
1944 | if (requestData.Contains("region_uuid")) | 1817 | Scene scene = null; |
1945 | { | 1818 | GetSceneFromRegionParams(requestData, responseData, out scene); |
1946 | UUID region_uuid = (UUID) (string) requestData["region_uuid"]; | ||
1947 | if (!m_application.SceneManager.TrySetCurrentScene(region_uuid)) | ||
1948 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
1949 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_uuid.ToString()); | ||
1950 | } | ||
1951 | else if (requestData.Contains("region_name")) | ||
1952 | { | ||
1953 | string region_name = (string) requestData["region_name"]; | ||
1954 | if (!m_application.SceneManager.TrySetCurrentScene(region_name)) | ||
1955 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
1956 | m_log.InfoFormat("[RADMIN]: Switched to region {0}", region_name); | ||
1957 | } | ||
1958 | else throw new Exception("neither region_name nor region_uuid given"); | ||
1959 | 1819 | ||
1960 | Scene scene = m_application.SceneManager.CurrentScene; | ||
1961 | UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess; | 1820 | UUID[] accessControlList = scene.RegionInfo.EstateSettings.EstateAccess; |
1962 | Hashtable users = new Hashtable(); | 1821 | Hashtable users = new Hashtable(); |
1963 | 1822 | ||
1964 | foreach (UUID user in accessControlList) | 1823 | foreach (UUID user in accessControlList) |
1965 | { | 1824 | { |
1966 | UUID scopeID = m_application.SceneManager.CurrentOrFirstScene.RegionInfo.ScopeID; | 1825 | UUID scopeID = scene.RegionInfo.ScopeID; |
1967 | UserAccount account = m_application.SceneManager.CurrentOrFirstScene.UserAccountService.GetUserAccount(scopeID, user); | 1826 | UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, user); |
1968 | if (account != null) | 1827 | if (account != null) |
1969 | { | 1828 | { |
1970 | users[user.ToString()] = account.FirstName + " " + account.LastName; | 1829 | users[user.ToString()] = account.FirstName + " " + account.LastName; |
@@ -1972,6 +1831,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1972 | } | 1831 | } |
1973 | 1832 | ||
1974 | responseData["users"] = users; | 1833 | responseData["users"] = users; |
1834 | responseData["success"] = true; | ||
1975 | 1835 | ||
1976 | m_log.Info("[RADMIN]: Access List List Request complete"); | 1836 | m_log.Info("[RADMIN]: Access List List Request complete"); |
1977 | } | 1837 | } |
@@ -2089,6 +1949,126 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2089 | } | 1949 | } |
2090 | } | 1950 | } |
2091 | 1951 | ||
1952 | private void CheckRegionParams(Hashtable requestData, Hashtable responseData) | ||
1953 | { | ||
1954 | //Checks if region parameters exist and gives exeption if no parameters are given | ||
1955 | if ((requestData.ContainsKey("region_id") && !String.IsNullOrEmpty((string)requestData["region_id"])) || | ||
1956 | (requestData.ContainsKey("region_name") && !String.IsNullOrEmpty((string)requestData["region_name"]))) | ||
1957 | { | ||
1958 | return; | ||
1959 | } | ||
1960 | #region Deprecate July 2012 | ||
1961 | //region_ID, regionid, region_uuid will be deprecated in July 2012!!!!!! | ||
1962 | else if (requestData.ContainsKey("regionid") && | ||
1963 | !String.IsNullOrEmpty((string)requestData["regionid"])) | ||
1964 | { | ||
1965 | m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead"); | ||
1966 | } | ||
1967 | else if (requestData.ContainsKey("region_ID") && | ||
1968 | !String.IsNullOrEmpty((string)requestData["region_ID"])) | ||
1969 | { | ||
1970 | m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead"); | ||
1971 | } | ||
1972 | else if (requestData.ContainsKey("regionID") && | ||
1973 | !String.IsNullOrEmpty((string)requestData["regionID"])) | ||
1974 | { | ||
1975 | m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead"); | ||
1976 | } | ||
1977 | else if (requestData.ContainsKey("region_uuid") && | ||
1978 | !String.IsNullOrEmpty((string)requestData["region_uuid"])) | ||
1979 | { | ||
1980 | m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead"); | ||
1981 | } | ||
1982 | #endregion | ||
1983 | else | ||
1984 | { | ||
1985 | responseData["accepted"] = false; | ||
1986 | throw new Exception("no region_name or region_id given"); | ||
1987 | } | ||
1988 | } | ||
1989 | |||
1990 | private void GetSceneFromRegionParams(Hashtable requestData, Hashtable responseData, out Scene scene) | ||
1991 | { | ||
1992 | scene = null; | ||
1993 | |||
1994 | if (requestData.ContainsKey("region_id") && | ||
1995 | !String.IsNullOrEmpty((string)requestData["region_id"])) | ||
1996 | { | ||
1997 | UUID regionID = (UUID)(string)requestData["region_id"]; | ||
1998 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
1999 | { | ||
2000 | responseData["error"] = String.Format("Region ID {0} not found", regionID); | ||
2001 | throw new Exception(String.Format("Region ID {0} not found", regionID)); | ||
2002 | } | ||
2003 | } | ||
2004 | #region Deprecate July 2012 | ||
2005 | else if (requestData.ContainsKey("regionid") && | ||
2006 | !String.IsNullOrEmpty((string)requestData["regionid"])) | ||
2007 | { | ||
2008 | m_log.WarnFormat("[RADMIN]: Use of parameter regionid will be deprecated as of July 2012. Use region_id instead"); | ||
2009 | |||
2010 | UUID regionID = (UUID)(string)requestData["regionid"]; | ||
2011 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
2012 | { | ||
2013 | responseData["error"] = String.Format("Region ID {0} not found", regionID); | ||
2014 | throw new Exception(String.Format("Region ID {0} not found", regionID)); | ||
2015 | } | ||
2016 | } | ||
2017 | else if (requestData.ContainsKey("region_ID") && | ||
2018 | !String.IsNullOrEmpty((string)requestData["region_ID"])) | ||
2019 | { | ||
2020 | m_log.WarnFormat("[RADMIN]: Use of parameter region_ID will be deprecated as of July 2012. Use region_id instead"); | ||
2021 | |||
2022 | UUID regionID = (UUID)(string)requestData["region_ID"]; | ||
2023 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
2024 | { | ||
2025 | responseData["error"] = String.Format("Region ID {0} not found", regionID); | ||
2026 | throw new Exception(String.Format("Region ID {0} not found", regionID)); | ||
2027 | } | ||
2028 | } | ||
2029 | else if (requestData.ContainsKey("regionID") && | ||
2030 | !String.IsNullOrEmpty((string)requestData["regionID"])) | ||
2031 | { | ||
2032 | m_log.WarnFormat("[RADMIN]: Use of parameter regionID will be deprecated as of July 2012. Use region_id instead"); | ||
2033 | |||
2034 | UUID regionID = (UUID)(string)requestData["regionID"]; | ||
2035 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
2036 | { | ||
2037 | responseData["error"] = String.Format("Region ID {0} not found", regionID); | ||
2038 | throw new Exception(String.Format("Region ID {0} not found", regionID)); | ||
2039 | } | ||
2040 | } | ||
2041 | else if (requestData.ContainsKey("region_uuid") && | ||
2042 | !String.IsNullOrEmpty((string)requestData["region_uuid"])) | ||
2043 | { | ||
2044 | m_log.WarnFormat("[RADMIN]: Use of parameter region_uuid will be deprecated as of July 2012. Use region_id instead"); | ||
2045 | |||
2046 | UUID regionID = (UUID)(string)requestData["region_uuid"]; | ||
2047 | if (!m_application.SceneManager.TryGetScene(regionID, out scene)) | ||
2048 | { | ||
2049 | responseData["error"] = String.Format("Region ID {0} not found", regionID); | ||
2050 | throw new Exception(String.Format("Region ID {0} not found", regionID)); | ||
2051 | } | ||
2052 | } | ||
2053 | #endregion | ||
2054 | else if (requestData.ContainsKey("region_name") && | ||
2055 | !String.IsNullOrEmpty((string)requestData["region_name"])) | ||
2056 | { | ||
2057 | string regionName = (string)requestData["region_name"]; | ||
2058 | if (!m_application.SceneManager.TryGetScene(regionName, out scene)) | ||
2059 | { | ||
2060 | responseData["error"] = String.Format("Region {0} not found", regionName); | ||
2061 | throw new Exception(String.Format("Region {0} not found", regionName)); | ||
2062 | } | ||
2063 | } | ||
2064 | else | ||
2065 | { | ||
2066 | responseData["error"] = "no region_name or region_id given"; | ||
2067 | throw new Exception("no region_name or region_id given"); | ||
2068 | } | ||
2069 | return; | ||
2070 | } | ||
2071 | |||
2092 | private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue) | 2072 | private bool GetBoolean(Hashtable requestData, string tag, bool defaultValue) |
2093 | { | 2073 | { |
2094 | // If an access value has been provided, apply it. | 2074 | // If an access value has been provided, apply it. |