aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2013-05-11 07:58:14 -0700
committerDiva Canto2013-05-11 07:58:14 -0700
commita4431381fa8a4f759a9c7eb9e30ae915504d4fdc (patch)
treeae5c03e2a5b9c29ec7c7b7245d64ebccebb4f005 /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.zip
opensim-SC-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.gz
opensim-SC-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.bz2
opensim-SC-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.xz
Finalize the logic for SetHome. See comments in Land/LandManagementModule.cs about who has permission to set home where.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs47
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs7
2 files changed, 19 insertions, 35 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index c295f3a..1789d6d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Land
75 protected IUserManagement m_userManager; 75 protected IUserManagement m_userManager;
76 protected IPrimCountModule m_primCountModule; 76 protected IPrimCountModule m_primCountModule;
77 protected IDialogModule m_Dialog; 77 protected IDialogModule m_Dialog;
78 protected IGroupsModule m_Groups;
79 78
80 // Minimum for parcels to work is 64m even if we don't actually use them. 79 // Minimum for parcels to work is 64m even if we don't actually use them.
81 #pragma warning disable 0429 80 #pragma warning disable 0429
@@ -156,7 +155,6 @@ namespace OpenSim.Region.CoreModules.World.Land
156 m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); 155 m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
157 m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); 156 m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
158 m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); 157 m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
159 m_Groups = m_scene.RequestModuleInterface<IGroupsModule>();
160 } 158 }
161 159
162 public void RemoveRegion(Scene scene) 160 public void RemoveRegion(Scene scene)
@@ -1838,44 +1836,37 @@ namespace OpenSim.Region.CoreModules.World.Land
1838 /// <param name="flags"></param> 1836 /// <param name="flags"></param>
1839 public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) 1837 public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
1840 { 1838 {
1841 m_log.DebugFormat("[XXX]: SetHome");
1842 // Let's find the parcel in question 1839 // Let's find the parcel in question
1843 ILandObject land = landChannel.GetLandObject(position); 1840 ILandObject land = landChannel.GetLandObject(position);
1844 if (land == null || m_scene.GridUserService == null) 1841 if (land == null || m_scene.GridUserService == null)
1845 { 1842 {
1846 m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); 1843 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
1847 return; 1844 return;
1848 } 1845 }
1849 1846
1850 // Can the user set home here? 1847 // Gather some data
1851 bool canSetHome = false; 1848 ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID);
1852 // (a) land owners can set home 1849 SceneObjectGroup telehub = null;
1853 if (remoteClient.AgentId == land.LandData.OwnerID)
1854 canSetHome = true;
1855 // (b) members of land-owned group in roles that can set home
1856 if (land.LandData.IsGroupOwned && m_Groups != null)
1857 {
1858 ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID);
1859 m_log.DebugFormat("[XXX]: GroupPowers 0x{0:x16}", gpowers);
1860 if ((gpowers & (ulong)GroupPowers.AllowSetHome) == 1)
1861 canSetHome = true;
1862 }
1863 // (c) parcels with telehubs can be the home of anyone
1864 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero) 1850 if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
1865 { 1851 // Does the telehub exist in the scene?
1866 // If the telehub in this parcel? 1852 telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
1867 SceneObjectGroup telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
1868 if (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))
1869 canSetHome = true;
1870 }
1871 1853
1872 if (canSetHome) 1854 // Can the user set home here?
1873 { 1855 if (// (a) gods and land managers can set home
1874 if (m_scene.GridUserService != null && m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) 1856 m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
1857 m_scene.Permissions.IsGod(remoteClient.AgentId) ||
1858 // (b) land owners can set home
1859 remoteClient.AgentId == land.LandData.OwnerID ||
1860 // (c) members of the land-associated group in roles that can set home
1861 ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
1862 // (d) parcels with telehubs can be the home of anyone
1863 (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
1864 {
1865 if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt))
1875 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. 1866 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
1876 m_Dialog.SendAlertToUser(remoteClient, "Home position set."); 1867 m_Dialog.SendAlertToUser(remoteClient, "Home position set.");
1877 else 1868 else
1878 m_Dialog.SendAlertToUser(remoteClient, "Set Home request Failed."); 1869 m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
1879 } 1870 }
1880 else 1871 else
1881 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); 1872 m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 5969d45..8406442 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -228,13 +228,6 @@ namespace OpenSim.Region.CoreModules.World.Land
228 if (estateModule != null) 228 if (estateModule != null)
229 regionFlags = estateModule.GetRegionFlags(); 229 regionFlags = estateModule.GetRegionFlags();
230 230
231 // In a perfect world, this would have worked.
232 //
233// if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0)
234// regionFlags |= (uint)RegionFlags.AllowLandmark;
235// if (landData.OwnerID == remote_client.AgentId)
236// regionFlags |= (uint)RegionFlags.AllowSetHome;
237
238 int seq_id; 231 int seq_id;
239 if (snap_selection && (sequence_id == 0)) 232 if (snap_selection && (sequence_id == 0))
240 { 233 {