diff options
author | Diva Canto | 2013-05-11 07:58:14 -0700 |
---|---|---|
committer | Diva Canto | 2013-05-11 07:58:14 -0700 |
commit | a4431381fa8a4f759a9c7eb9e30ae915504d4fdc (patch) | |
tree | ae5c03e2a5b9c29ec7c7b7245d64ebccebb4f005 | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.zip opensim-SC_OLD-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.gz opensim-SC_OLD-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.bz2 opensim-SC_OLD-a4431381fa8a4f759a9c7eb9e30ae915504d4fdc.tar.xz |
Finalize the logic for SetHome. See comments in Land/LandManagementModule.cs about who has permission to set home where.
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 19 |
3 files changed, 19 insertions, 54 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 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 80c4922..6bbcbd7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3090,7 +3090,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3090 | { | 3090 | { |
3091 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 3091 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
3092 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 3092 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
3093 | client.OnSetStartLocationRequest += SetHomeRezPoint; | ||
3094 | client.OnRegionHandleRequest += RegionHandleRequest; | 3093 | client.OnRegionHandleRequest += RegionHandleRequest; |
3095 | } | 3094 | } |
3096 | 3095 | ||
@@ -3215,7 +3214,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3215 | { | 3214 | { |
3216 | //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; | 3215 | //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
3217 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 3216 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
3218 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | ||
3219 | client.OnRegionHandleRequest -= RegionHandleRequest; | 3217 | client.OnRegionHandleRequest -= RegionHandleRequest; |
3220 | } | 3218 | } |
3221 | 3219 | ||
@@ -3342,23 +3340,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3342 | } | 3340 | } |
3343 | 3341 | ||
3344 | /// <summary> | 3342 | /// <summary> |
3345 | /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in | ||
3346 | /// </summary> | ||
3347 | /// <param name="remoteClient"></param> | ||
3348 | /// <param name="regionHandle"></param> | ||
3349 | /// <param name="position"></param> | ||
3350 | /// <param name="lookAt"></param> | ||
3351 | /// <param name="flags"></param> | ||
3352 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | ||
3353 | { | ||
3354 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | ||
3355 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | ||
3356 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | ||
3357 | else | ||
3358 | m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed."); | ||
3359 | } | ||
3360 | |||
3361 | /// <summary> | ||
3362 | /// Get the avatar apperance for the given client. | 3343 | /// Get the avatar apperance for the given client. |
3363 | /// </summary> | 3344 | /// </summary> |
3364 | /// <param name="client"></param> | 3345 | /// <param name="client"></param> |