aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2016-06-20 10:08:15 -0700
committerDiva Canto2016-06-20 10:08:15 -0700
commit359908fa88c4f9188746e87350701750478fbf2f (patch)
treee15d62226bb52b8cdaf92eb9847ca008bef68f1e
parentMantis #7929: objects deeded to the group were loosing some important propert... (diff)
downloadopensim-SC_OLD-359908fa88c4f9188746e87350701750478fbf2f.zip
opensim-SC_OLD-359908fa88c4f9188746e87350701750478fbf2f.tar.gz
opensim-SC_OLD-359908fa88c4f9188746e87350701750478fbf2f.tar.bz2
opensim-SC_OLD-359908fa88c4f9188746e87350701750478fbf2f.tar.xz
Related to mantis #7929: "For sale" was not being accepted, because of permissions fail. This adds a new permissions check CanSellGroupObject. THIRD-PARTY PERMISSIONS MODULES TAKE NOTE OF THIS NEW EVENT.
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs31
3 files changed, 53 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 0e0f05f..42141e4 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -45,8 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")] 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")]
46 public class BuySellModule : IBuySellModule, INonSharedRegionModule 46 public class BuySellModule : IBuySellModule, INonSharedRegionModule
47 { 47 {
48// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51 protected IDialogModule m_dialogModule; 51 protected IDialogModule m_dialogModule;
52 52
@@ -92,9 +92,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
92 if (part.ParentGroup.IsDeleted) 92 if (part.ParentGroup.IsDeleted)
93 return; 93 return;
94 94
95 if (part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId))) 95 if (part.OwnerID != part.GroupID && part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId)))
96 return; 96 return;
97 97
98 if (part.OwnerID == part.GroupID) // Group owned
99 {
100 // Does the user have the power to put the object on sale?
101 if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID, m_scene))
102 {
103 client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
104 return;
105 }
106 }
107
98 part = part.ParentGroup.RootPart; 108 part = part.ParentGroup.RootPart;
99 109
100 part.ObjectSaleType = saleType; 110 part.ObjectSaleType = saleType;
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b57c3d7..c83454e 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -288,6 +288,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
288 m_scene.Permissions.OnCompileScript += CanCompileScript; 288 m_scene.Permissions.OnCompileScript += CanCompileScript;
289 m_scene.Permissions.OnSellParcel += CanSellParcel; 289 m_scene.Permissions.OnSellParcel += CanSellParcel;
290 m_scene.Permissions.OnTakeObject += CanTakeObject; 290 m_scene.Permissions.OnTakeObject += CanTakeObject;
291 m_scene.Permissions.OnSellGroupObject += CanSellGroupObject;
291 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; 292 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
292 m_scene.Permissions.OnTerraformLand += CanTerraformLand; 293 m_scene.Permissions.OnTerraformLand += CanTerraformLand;
293 m_scene.Permissions.OnLinkObject += CanLinkObject; 294 m_scene.Permissions.OnLinkObject += CanLinkObject;
@@ -1511,6 +1512,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1511 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, true); 1512 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, true);
1512 } 1513 }
1513 1514
1515 private bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
1516 {
1517 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1518 if (m_bypassPermissions) return m_bypassPermissionsValue;
1519
1520 return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
1521 }
1522
1514 private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene) 1523 private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
1515 { 1524 {
1516 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1525 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index a901cfe..b26b789 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Region.Framework.Scenes
45 public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); 45 public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
46 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); 46 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
47 public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); 47 public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
48 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
48 public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); 49 public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
49 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
50 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
@@ -114,6 +115,7 @@ namespace OpenSim.Region.Framework.Scenes
114 public event DeleteObjectHandler OnDeleteObject; 115 public event DeleteObjectHandler OnDeleteObject;
115 public event TransferObjectHandler OnTransferObject; 116 public event TransferObjectHandler OnTransferObject;
116 public event TakeObjectHandler OnTakeObject; 117 public event TakeObjectHandler OnTakeObject;
118 public event SellGroupObjectHandler OnSellGroupObject;
117 public event TakeCopyObjectHandler OnTakeCopyObject; 119 public event TakeCopyObjectHandler OnTakeCopyObject;
118 public event DuplicateObjectHandler OnDuplicateObject; 120 public event DuplicateObjectHandler OnDuplicateObject;
119 public event EditObjectHandler OnEditObject; 121 public event EditObjectHandler OnEditObject;
@@ -328,6 +330,35 @@ namespace OpenSim.Region.Framework.Scenes
328 330
329 #endregion 331 #endregion
330 332
333 #region SELL GROUP OBJECT
334 public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
335 {
336 bool result = true;
337
338 SellGroupObjectHandler handler = OnSellGroupObject;
339 if (handler != null)
340 {
341 Delegate[] list = handler.GetInvocationList();
342 foreach (SellGroupObjectHandler h in list)
343 {
344 if (h(userID, groupID, scene) == false)
345 {
346 result = false;
347 break;
348 }
349 }
350 }
351
352 //m_log.DebugFormat(
353 // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
354 // userID, groupID, result);
355
356 return result;
357 }
358
359 #endregion
360
361
331 #region TAKE COPY OBJECT 362 #region TAKE COPY OBJECT
332 public bool CanTakeCopyObject(UUID objectID, UUID userID) 363 public bool CanTakeCopyObject(UUID objectID, UUID userID)
333 { 364 {