Reapplying a revised version of Christopher Yeoh's (IBM) patch for allow
inventory drop. Also adds a new flags, "propagate_permissions" to OpenSim.ini to control that feature.0.6.1-post-fixes
parent
165fcd1aac
commit
edee11ff87
|
@ -591,7 +591,9 @@ namespace OpenSim.Data.Tests
|
||||||
Assert.That(t.ItemID,Is.EqualTo(id));
|
Assert.That(t.ItemID,Is.EqualTo(id));
|
||||||
Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID));
|
Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID));
|
||||||
Assert.That(t.NextPermissions, Is.EqualTo(nextperm));
|
Assert.That(t.NextPermissions, Is.EqualTo(nextperm));
|
||||||
Assert.That(t.OwnerID,Is.EqualTo(owner));
|
// Ownership changes when you drop an object into an object
|
||||||
|
// owned by someone else
|
||||||
|
Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID));
|
||||||
Assert.That(t.CurrentPermissions, Is.EqualTo(curperm));
|
Assert.That(t.CurrentPermissions, Is.EqualTo(curperm));
|
||||||
Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID));
|
Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID));
|
||||||
Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID));
|
Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID));
|
||||||
|
@ -848,4 +850,4 @@ namespace OpenSim.Data.Tests
|
||||||
// return f;
|
// return f;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
// Bypasses the permissions engine
|
// Bypasses the permissions engine
|
||||||
private bool m_bypassPermissions = true;
|
private bool m_bypassPermissions = true;
|
||||||
private bool m_bypassPermissionsValue = true;
|
private bool m_bypassPermissionsValue = true;
|
||||||
|
private bool m_propagatePermissions = false;
|
||||||
private bool m_debugPermissions = false;
|
private bool m_debugPermissions = false;
|
||||||
private bool m_allowGridGods = false;
|
private bool m_allowGridGods = false;
|
||||||
private bool m_RegionOwnerIsGod = false;
|
private bool m_RegionOwnerIsGod = false;
|
||||||
|
@ -143,6 +144,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
|
|
||||||
m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false);
|
m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false);
|
||||||
m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true);
|
m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true);
|
||||||
|
m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true);
|
||||||
m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
|
m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
|
||||||
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
|
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
|
||||||
|
|
||||||
|
@ -278,7 +280,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
||||||
|
|
||||||
public bool PropagatePermissions()
|
public bool PropagatePermissions()
|
||||||
{
|
{
|
||||||
return false;
|
if (m_bypassPermissions)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return m_propagatePermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BypassPermissions()
|
public bool BypassPermissions()
|
||||||
|
|
|
@ -1179,7 +1179,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
destTaskItem.InvType = srcTaskItem.InvType;
|
destTaskItem.InvType = srcTaskItem.InvType;
|
||||||
destTaskItem.Type = srcTaskItem.Type;
|
destTaskItem.Type = srcTaskItem.Type;
|
||||||
|
|
||||||
destPart.AddInventoryItem(destTaskItem);
|
destPart.AddInventoryItem(destTaskItem, part.OwnerID != destPart.OwnerID);
|
||||||
|
|
||||||
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||||
part.RemoveInventoryItem(itemId);
|
part.RemoveInventoryItem(itemId);
|
||||||
|
@ -1249,10 +1249,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
|
||||||
return;
|
|
||||||
|
|
||||||
TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
|
TaskInventoryItem currentItem = part.GetInventoryItem(itemID);
|
||||||
|
bool allowInventoryDrop = (part.GetEffectiveObjectFlags()
|
||||||
|
& (uint)PrimFlags.AllowInventoryDrop) != 0;
|
||||||
|
|
||||||
|
// Explicity allow anyone to add to the inventory if the
|
||||||
|
// AllowInventoryDrop flag has been set. Don't however let
|
||||||
|
// them update an item unless they pass the external checks
|
||||||
|
//
|
||||||
|
if (!ExternalChecks.ExternalChecksCanEditObjectInventory(part.UUID, remoteClient.AgentId)
|
||||||
|
&& (currentItem != null || !allowInventoryDrop ))
|
||||||
|
return;
|
||||||
|
|
||||||
if (currentItem == null)
|
if (currentItem == null)
|
||||||
{
|
{
|
||||||
|
@ -1417,7 +1424,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
taskItem.PermsMask = 0;
|
taskItem.PermsMask = 0;
|
||||||
taskItem.AssetID = asset.FullID;
|
taskItem.AssetID = asset.FullID;
|
||||||
|
|
||||||
part.AddInventoryItem(taskItem);
|
part.AddInventoryItem(taskItem, false);
|
||||||
part.GetProperties(remoteClient);
|
part.GetProperties(remoteClient);
|
||||||
|
|
||||||
part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
part.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
|
||||||
|
@ -1512,7 +1519,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
destTaskItem.InvType = srcTaskItem.InvType;
|
destTaskItem.InvType = srcTaskItem.InvType;
|
||||||
destTaskItem.Type = srcTaskItem.Type;
|
destTaskItem.Type = srcTaskItem.Type;
|
||||||
|
|
||||||
destPart.AddInventoryItemExclusive(destTaskItem);
|
destPart.AddInventoryItemExclusive(destTaskItem, false);
|
||||||
|
|
||||||
if (running > 0)
|
if (running > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,23 +151,44 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
taskItem.AssetID = item.AssetID;
|
taskItem.AssetID = item.AssetID;
|
||||||
taskItem.Name = item.Name;
|
taskItem.Name = item.Name;
|
||||||
taskItem.Description = item.Description;
|
taskItem.Description = item.Description;
|
||||||
taskItem.OwnerID = item.Owner;
|
taskItem.OwnerID = part.OwnerID; // Transfer ownership
|
||||||
taskItem.CreatorID = item.Creator;
|
taskItem.CreatorID = item.Creator;
|
||||||
taskItem.Type = item.AssetType;
|
taskItem.Type = item.AssetType;
|
||||||
taskItem.InvType = item.InvType;
|
taskItem.InvType = item.InvType;
|
||||||
|
|
||||||
taskItem.BasePermissions = item.BasePermissions;
|
if (remoteClient != null &&
|
||||||
taskItem.CurrentPermissions = item.CurrentPermissions;
|
remoteClient.AgentId != part.OwnerID &&
|
||||||
// FIXME: ignoring group permissions for now as they aren't stored in item
|
m_scene.ExternalChecks.ExternalChecksPropagatePermissions())
|
||||||
taskItem.EveryonePermissions = item.EveryOnePermissions;
|
{
|
||||||
taskItem.NextPermissions = item.NextPermissions;
|
taskItem.BasePermissions = item.BasePermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.CurrentPermissions = item.CurrentPermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.EveryonePermissions = item.EveryOnePermissions &
|
||||||
|
item.NextPermissions;
|
||||||
|
taskItem.NextPermissions = item.NextPermissions;
|
||||||
|
taskItem.CurrentPermissions |= 8;
|
||||||
|
} else {
|
||||||
|
taskItem.BasePermissions = item.BasePermissions;
|
||||||
|
taskItem.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
taskItem.CurrentPermissions |= 8;
|
||||||
|
taskItem.EveryonePermissions = item.EveryOnePermissions;
|
||||||
|
taskItem.NextPermissions = item.NextPermissions;
|
||||||
|
}
|
||||||
|
|
||||||
taskItem.Flags = item.Flags;
|
taskItem.Flags = item.Flags;
|
||||||
// TODO: These are pending addition of those fields to TaskInventoryItem
|
// TODO: These are pending addition of those fields to TaskInventoryItem
|
||||||
// taskItem.SalePrice = item.SalePrice;
|
// taskItem.SalePrice = item.SalePrice;
|
||||||
// taskItem.SaleType = item.SaleType;
|
// taskItem.SaleType = item.SaleType;
|
||||||
taskItem.CreationDate = (uint)item.CreationDate;
|
taskItem.CreationDate = (uint)item.CreationDate;
|
||||||
|
|
||||||
|
bool addFromAllowedDrop = false;
|
||||||
|
if (remoteClient!=null)
|
||||||
|
{
|
||||||
|
addFromAllowedDrop = remoteClient.AgentId!=part.OwnerID;
|
||||||
|
}
|
||||||
|
|
||||||
part.AddInventoryItem(taskItem);
|
part.AddInventoryItem(taskItem, addFromAllowedDrop);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,16 +289,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// name is chosen.
|
/// name is chosen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void AddInventoryItem(TaskInventoryItem item)
|
public void AddInventoryItem(TaskInventoryItem item, bool allowedDrop)
|
||||||
{
|
{
|
||||||
AddInventoryItem(item.Name, item);
|
AddInventoryItem(item.Name, item, allowedDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an item to this prim's inventory. If an item with the same name already exists, it is replaced.
|
/// Add an item to this prim's inventory. If an item with the same name already exists, it is replaced.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void AddInventoryItemExclusive(TaskInventoryItem item)
|
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
|
||||||
{
|
{
|
||||||
List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values);
|
List<TaskInventoryItem> il = new List<TaskInventoryItem>(m_taskInventory.Values);
|
||||||
foreach (TaskInventoryItem i in il)
|
foreach (TaskInventoryItem i in il)
|
||||||
|
@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddInventoryItem(item.Name, item);
|
AddInventoryItem(item.Name, item, allowedDrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -324,7 +324,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// The item itself. The name within this structure is ignored in favour of the name
|
/// The item itself. The name within this structure is ignored in favour of the name
|
||||||
/// given in this method's arguments
|
/// given in this method's arguments
|
||||||
/// </param>
|
/// </param>
|
||||||
protected void AddInventoryItem(string name, TaskInventoryItem item)
|
/// <param name="allowedDrop">
|
||||||
|
/// Item was only added to inventory because AllowedDrop is set
|
||||||
|
/// </param>
|
||||||
|
protected void AddInventoryItem(string name, TaskInventoryItem item, bool allowedDrop)
|
||||||
{
|
{
|
||||||
name = FindAvailableInventoryName(name);
|
name = FindAvailableInventoryName(name);
|
||||||
if (name == String.Empty)
|
if (name == String.Empty)
|
||||||
|
@ -337,7 +340,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
lock (m_taskInventory)
|
lock (m_taskInventory)
|
||||||
{
|
{
|
||||||
m_taskInventory.Add(item.ItemID, item);
|
m_taskInventory.Add(item.ItemID, item);
|
||||||
TriggerScriptChangedEvent(Changed.INVENTORY);
|
|
||||||
|
if (allowedDrop)
|
||||||
|
TriggerScriptChangedEvent(Changed.ALLOWED_DROP);
|
||||||
|
else
|
||||||
|
TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
|
|
|
@ -4006,6 +4006,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.ParentGroup.RootPart.AllowedDrop = true;
|
m_host.ParentGroup.RootPart.AllowedDrop = true;
|
||||||
else
|
else
|
||||||
m_host.ParentGroup.RootPart.AllowedDrop = false;
|
m_host.ParentGroup.RootPart.AllowedDrop = false;
|
||||||
|
|
||||||
|
// Update the object flags
|
||||||
|
m_host.ParentGroup.RootPart.aggregateScriptEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Vector llGetSunDirection()
|
public LSL_Vector llGetSunDirection()
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
taskItem.PermsMask = 0;
|
taskItem.PermsMask = 0;
|
||||||
taskItem.AssetID = asset.FullID;
|
taskItem.AssetID = asset.FullID;
|
||||||
|
|
||||||
m_host.AddInventoryItem(taskItem);
|
m_host.AddInventoryItem(taskItem, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue