diff options
author | Diva Canto | 2012-03-22 12:57:12 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-22 12:57:12 -0700 |
commit | 6146e7ef258b10888ad7464b72b75cca701e02c9 (patch) | |
tree | 6603496c5758359b808f8719a641977660aca0fb /OpenSim | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-6146e7ef258b10888ad7464b72b75cca701e02c9.zip opensim-SC_OLD-6146e7ef258b10888ad7464b72b75cca701e02c9.tar.gz opensim-SC_OLD-6146e7ef258b10888ad7464b72b75cca701e02c9.tar.bz2 opensim-SC_OLD-6146e7ef258b10888ad7464b72b75cca701e02c9.tar.xz |
Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/ILandObject.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 17 |
4 files changed, 88 insertions, 6 deletions
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index dd73b3f..33aad9b 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs | |||
@@ -63,6 +63,7 @@ namespace OpenSim.Framework | |||
63 | bool ContainsPoint(int x, int y); | 63 | bool ContainsPoint(int x, int y); |
64 | 64 | ||
65 | ILandObject Copy(); | 65 | ILandObject Copy(); |
66 | ILandObject MemberwiseCopy(); | ||
66 | 67 | ||
67 | void SendLandUpdateToAvatarsOverMe(); | 68 | void SendLandUpdateToAvatarsOverMe(); |
68 | 69 | ||
@@ -70,6 +71,7 @@ namespace OpenSim.Framework | |||
70 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); | 71 | void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); |
71 | bool IsEitherBannedOrRestricted(UUID avatar); | 72 | bool IsEitherBannedOrRestricted(UUID avatar); |
72 | bool IsBannedFromLand(UUID avatar); | 73 | bool IsBannedFromLand(UUID avatar); |
74 | bool IsAllowedInLand(UUID avatar); | ||
73 | bool IsRestrictedFromLand(UUID avatar); | 75 | bool IsRestrictedFromLand(UUID avatar); |
74 | void SendLandUpdateToClient(IClientAPI remote_client); | 76 | void SendLandUpdateToClient(IClientAPI remote_client); |
75 | void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); | 77 | void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cc42f7f..640a024 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -169,6 +169,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
169 | return newLand; | 169 | return newLand; |
170 | } | 170 | } |
171 | 171 | ||
172 | public ILandObject MemberwiseCopy() | ||
173 | { | ||
174 | return (ILandObject)this.MemberwiseClone(); | ||
175 | } | ||
176 | |||
172 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; | 177 | static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; |
173 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; | 178 | static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; |
174 | 179 | ||
@@ -242,11 +247,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
242 | m_lastSeqId = seq_id; | 247 | m_lastSeqId = seq_id; |
243 | } | 248 | } |
244 | 249 | ||
250 | ILandObject landToSend = this; | ||
251 | m_scene.Permissions.LandObjectForClient(remote_client.AgentId, (ILandObject)this, out landToSend); | ||
245 | remote_client.SendLandProperties(seq_id, | 252 | remote_client.SendLandProperties(seq_id, |
246 | snap_selection, request_result, this, | 253 | snap_selection, request_result, landToSend, |
247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 254 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
248 | GetParcelMaxPrimCount(), | 255 | GetParcelMaxPrimCount(), |
249 | GetSimulatorMaxPrimCount(), regionFlags); | 256 | GetSimulatorMaxPrimCount(), regionFlags); |
250 | } | 257 | } |
251 | 258 | ||
252 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 259 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) |
@@ -475,6 +482,32 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
475 | return false; | 482 | return false; |
476 | } | 483 | } |
477 | 484 | ||
485 | public bool IsAllowedInLand(UUID avatar) | ||
486 | { | ||
487 | ExpireAccessList(); | ||
488 | |||
489 | if (m_scene.Permissions.IsAdministrator(avatar)) | ||
490 | return true; | ||
491 | |||
492 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
493 | return true; | ||
494 | |||
495 | if (avatar == LandData.OwnerID) | ||
496 | return true; | ||
497 | |||
498 | if (LandData.ParcelAccessList.FindIndex( | ||
499 | delegate(LandAccessEntry e) | ||
500 | { | ||
501 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | ||
502 | return true; | ||
503 | return false; | ||
504 | }) != -1) | ||
505 | { | ||
506 | return true; | ||
507 | } | ||
508 | return false; | ||
509 | } | ||
510 | |||
478 | public void SendLandUpdateToClient(IClientAPI remote_client) | 511 | public void SendLandUpdateToClient(IClientAPI remote_client) |
479 | { | 512 | { |
480 | SendLandProperties(0, false, 0, remote_client); | 513 | SendLandProperties(0, false, 0, remote_client); |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 6018c39..f536a0f 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
94 | private bool m_RegionOwnerIsGod = false; | 94 | private bool m_RegionOwnerIsGod = false; |
95 | private bool m_RegionManagerIsGod = false; | 95 | private bool m_RegionManagerIsGod = false; |
96 | private bool m_ParcelOwnerIsGod = false; | 96 | private bool m_ParcelOwnerIsGod = false; |
97 | 97 | ||
98 | private bool m_SimpleBuildPermissions = false; | ||
99 | |||
98 | /// <value> | 100 | /// <value> |
99 | /// The set of users that are allowed to create scripts. This is only active if permissions are not being | 101 | /// The set of users that are allowed to create scripts. This is only active if permissions are not being |
100 | /// bypassed. This overrides normal permissions. | 102 | /// bypassed. This overrides normal permissions. |
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
139 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); | 141 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); |
140 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); | 142 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); |
141 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); | 143 | m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); |
142 | 144 | ||
145 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); | ||
146 | |||
143 | m_allowedScriptCreators | 147 | m_allowedScriptCreators |
144 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); | 148 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); |
145 | m_allowedScriptEditors | 149 | m_allowedScriptEditors |
@@ -206,6 +210,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
206 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | 210 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; |
207 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; | 211 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; |
208 | 212 | ||
213 | if (m_SimpleBuildPermissions) | ||
214 | m_scene.Permissions.OnSendLandProperties += GenerateLandProperties; | ||
215 | |||
209 | m_scene.AddCommand("Users", this, "bypass permissions", | 216 | m_scene.AddCommand("Users", this, "bypass permissions", |
210 | "bypass permissions <true / false>", | 217 | "bypass permissions <true / false>", |
211 | "Bypass permission checks", | 218 | "Bypass permission checks", |
@@ -824,6 +831,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
824 | permission = true; | 831 | permission = true; |
825 | } | 832 | } |
826 | 833 | ||
834 | if (m_SimpleBuildPermissions && | ||
835 | (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsAllowedInLand(user)) | ||
836 | permission = true; | ||
837 | |||
827 | return permission; | 838 | return permission; |
828 | } | 839 | } |
829 | 840 | ||
@@ -1966,5 +1977,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1966 | 1977 | ||
1967 | return false; | 1978 | return false; |
1968 | } | 1979 | } |
1980 | |||
1981 | private void GenerateLandProperties(UUID userID, ILandObject realLand, out ILandObject landToSend) | ||
1982 | { | ||
1983 | landToSend = realLand; | ||
1984 | if (m_bypassPermissions) return; | ||
1985 | |||
1986 | if (m_SimpleBuildPermissions && | ||
1987 | !m_scene.Permissions.IsAdministrator(userID) && | ||
1988 | !realLand.LandData.OwnerID.Equals(userID) && | ||
1989 | ((realLand.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && realLand.IsAllowedInLand(userID))) | ||
1990 | { | ||
1991 | ILandObject clone = realLand.MemberwiseCopy(); | ||
1992 | LandData ldata = realLand.LandData.Copy(); | ||
1993 | clone.LandData = ldata; | ||
1994 | clone.LandData.Flags |= (uint)(ParcelFlags.AllowAPrimitiveEntry | ParcelFlags.AllowFly | ParcelFlags.AllowOtherScripts | ParcelFlags.CreateObjects); | ||
1995 | landToSend = clone; | ||
1996 | } | ||
1997 | } | ||
1998 | |||
1969 | } | 1999 | } |
1970 | } | 2000 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4..a4605c4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | public delegate bool TeleportHandler(UUID userID, Scene scene); | 90 | public delegate bool TeleportHandler(UUID userID, Scene scene); |
91 | public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); | 91 | public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); |
92 | public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); | 92 | public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); |
93 | public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); | ||
93 | #endregion | 94 | #endregion |
94 | 95 | ||
95 | public class ScenePermissions | 96 | public class ScenePermissions |
@@ -157,6 +158,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
157 | public event TeleportHandler OnTeleport; | 158 | public event TeleportHandler OnTeleport; |
158 | public event ControlPrimMediaHandler OnControlPrimMedia; | 159 | public event ControlPrimMediaHandler OnControlPrimMedia; |
159 | public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; | 160 | public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; |
161 | public event SendLandPropertiesHandler OnSendLandProperties; | ||
160 | #endregion | 162 | #endregion |
161 | 163 | ||
162 | #region Object Permission Checks | 164 | #region Object Permission Checks |
@@ -1098,5 +1100,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1098 | } | 1100 | } |
1099 | return true; | 1101 | return true; |
1100 | } | 1102 | } |
1103 | |||
1104 | public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) | ||
1105 | { | ||
1106 | landToSend = realLand; | ||
1107 | SendLandPropertiesHandler handler = OnSendLandProperties; | ||
1108 | if (handler != null) | ||
1109 | { | ||
1110 | Delegate[] list = handler.GetInvocationList(); | ||
1111 | foreach (SendLandPropertiesHandler h in list) | ||
1112 | { | ||
1113 | h(userID, realLand, out landToSend); | ||
1114 | } | ||
1115 | } | ||
1116 | } | ||
1117 | |||
1101 | } | 1118 | } |
1102 | } | 1119 | } |