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/Region/CoreModules/World | |
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 '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 41 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 34 |
2 files changed, 69 insertions, 6 deletions
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 | } |