From 13f31fdf85c404896c166932730b7b8bc5416626 Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Mon, 4 Nov 2013 19:28:24 +0200
Subject: Refactored setting permissions when rezzing items: use the same
function when rezzing from user inventory and prim inventory.
Also, fixed a bug: when rezzing a coalesced object from a prim's inventory, apply the coalesced object's name and description only to the first sub-object; not to all the objects in the coalescence. (This was already done correctly when rezzing from a user's inventory.)
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 58 ++++++++++++++++++++++
1 file changed, 58 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ea9d0d8..1cf7726 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4800,6 +4800,64 @@ namespace OpenSim.Region.Framework.Scenes
{
ParentGroup.AddScriptLPS(count);
}
+
+ ///
+ /// Sets a prim's owner and permissions when it's rezzed.
+ ///
+ /// The inventory item from which the item was rezzed
+ /// True: the item is being rezzed from the user's inventory. False: from a prim's inventory.
+ /// The scene the prim is being rezzed into
+ public void ApplyPermissionsOnRez(InventoryItemBase item, bool userInventory, Scene scene)
+ {
+ if ((OwnerID != item.Owner) || ((item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) || ((item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0))
+ {
+ if (scene.Permissions.PropagatePermissions())
+ {
+ if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
+ {
+ // Apply the item's permissions to the object
+ //LogPermissions("Before applying item permissions");
+ if (userInventory)
+ {
+ EveryoneMask = item.EveryOnePermissions;
+ NextOwnerMask = item.NextPermissions;
+ }
+ else
+ {
+ if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
+ EveryoneMask = item.EveryOnePermissions;
+ if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
+ NextOwnerMask = item.NextPermissions;
+ if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
+ GroupMask = item.GroupPermissions;
+ }
+ //LogPermissions("After applying item permissions");
+ }
+ }
+
+ GroupMask = 0; // DO NOT propagate here
+ }
+
+ if (OwnerID != item.Owner)
+ {
+ //LogPermissions("Before ApplyNextOwnerPermissions");
+ ApplyNextOwnerPermissions();
+ //LogPermissions("After ApplyNextOwnerPermissions");
+
+ LastOwnerID = OwnerID;
+ OwnerID = item.Owner;
+ Inventory.ChangeInventoryOwner(item.Owner);
+ }
+ }
+
+ ///
+ /// Logs the prim's permissions. Useful when debugging permission problems.
+ ///
+ ///
+ private void LogPermissions(String message)
+ {
+ PermissionsUtil.LogPermissions(Name, message, BaseMask, OwnerMask, NextOwnerMask);
+ }
public void ApplyNextOwnerPermissions()
{
--
cgit v1.1