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.
parent
623a2f859f
commit
359908fa88
|
@ -45,8 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BuySellModule")]
|
||||
public class BuySellModule : IBuySellModule, INonSharedRegionModule
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Scene m_scene = null;
|
||||
protected IDialogModule m_dialogModule;
|
||||
|
||||
|
@ -92,9 +92,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
if (part.ParentGroup.IsDeleted)
|
||||
return;
|
||||
|
||||
if (part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId)))
|
||||
if (part.OwnerID != part.GroupID && part.OwnerID != client.AgentId && (!m_scene.Permissions.IsGod(client.AgentId)))
|
||||
return;
|
||||
|
||||
if (part.OwnerID == part.GroupID) // Group owned
|
||||
{
|
||||
// Does the user have the power to put the object on sale?
|
||||
if (!m_scene.Permissions.CanSellGroupObject(client.AgentId, part.GroupID, m_scene))
|
||||
{
|
||||
client.SendAgentAlertMessage("You don't have permission to set group-owned objects on sale", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
part = part.ParentGroup.RootPart;
|
||||
|
||||
part.ObjectSaleType = saleType;
|
||||
|
|
|
@ -288,6 +288,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
m_scene.Permissions.OnCompileScript += CanCompileScript;
|
||||
m_scene.Permissions.OnSellParcel += CanSellParcel;
|
||||
m_scene.Permissions.OnTakeObject += CanTakeObject;
|
||||
m_scene.Permissions.OnSellGroupObject += CanSellGroupObject;
|
||||
m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
|
||||
m_scene.Permissions.OnTerraformLand += CanTerraformLand;
|
||||
m_scene.Permissions.OnLinkObject += CanLinkObject;
|
||||
|
@ -1511,6 +1512,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandSetSale, true);
|
||||
}
|
||||
|
||||
private bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return IsGroupMember(groupID, userID, (ulong)GroupPowers.ObjectSetForSale);
|
||||
}
|
||||
|
||||
private bool CanTakeObject(UUID objectID, UUID stealer, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
|
||||
public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene);
|
||||
public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
|
||||
public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene);
|
||||
public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
|
||||
public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
|
||||
public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene);
|
||||
|
@ -114,6 +115,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event DeleteObjectHandler OnDeleteObject;
|
||||
public event TransferObjectHandler OnTransferObject;
|
||||
public event TakeObjectHandler OnTakeObject;
|
||||
public event SellGroupObjectHandler OnSellGroupObject;
|
||||
public event TakeCopyObjectHandler OnTakeCopyObject;
|
||||
public event DuplicateObjectHandler OnDuplicateObject;
|
||||
public event EditObjectHandler OnEditObject;
|
||||
|
@ -328,6 +330,35 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#endregion
|
||||
|
||||
#region SELL GROUP OBJECT
|
||||
public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
SellGroupObjectHandler handler = OnSellGroupObject;
|
||||
if (handler != null)
|
||||
{
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (SellGroupObjectHandler h in list)
|
||||
{
|
||||
if (h(userID, groupID, scene) == false)
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//m_log.DebugFormat(
|
||||
// "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
|
||||
// userID, groupID, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region TAKE COPY OBJECT
|
||||
public bool CanTakeCopyObject(UUID objectID, UUID userID)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue