diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 109 |
2 files changed, 59 insertions, 55 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7377e6d..dbc7def 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1648,7 +1648,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1648 | if (itemID == UUID.Zero) | 1648 | if (itemID == UUID.Zero) |
1649 | { | 1649 | { |
1650 | m_log.ErrorFormat( | 1650 | m_log.ErrorFormat( |
1651 | "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero to update for {1}!", | 1651 | "[PRIM INVENTORY]: UpdateTaskInventory called with item ID Zero on update for {1}!", |
1652 | remoteClient.Name); | 1652 | remoteClient.Name); |
1653 | return; | 1653 | return; |
1654 | } | 1654 | } |
@@ -1686,7 +1686,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1686 | return; | 1686 | return; |
1687 | 1687 | ||
1688 | UUID copyID = UUID.Random(); | 1688 | UUID copyID = UUID.Random(); |
1689 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID); | 1689 | bool modrights = Permissions.CanEditObject(part.ParentGroup, remoteClient); |
1690 | part.ParentGroup.AddInventoryItem(remoteClient.AgentId, primLocalID, item, copyID, modrights); | ||
1690 | m_log.InfoFormat( | 1691 | m_log.InfoFormat( |
1691 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1692 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1692 | item.Name, primLocalID, remoteClient.Name); | 1693 | item.Name, primLocalID, remoteClient.Name); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index ddb03c3..12e53a8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
111 | /// <param name="item">The user inventory item being added.</param> | 111 | /// <param name="item">The user inventory item being added.</param> |
112 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> | 112 | /// <param name="copyItemID">The item UUID that should be used by the new item.</param> |
113 | /// <returns></returns> | 113 | /// <returns></returns> |
114 | public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID) | 114 | public bool AddInventoryItem(UUID agentID, uint localID, InventoryItemBase item, UUID copyItemID, bool withModRights = true) |
115 | { | 115 | { |
116 | // m_log.DebugFormat( | 116 | // m_log.DebugFormat( |
117 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", | 117 | // "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", |
@@ -120,69 +120,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID; | 120 | UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID; |
121 | 121 | ||
122 | SceneObjectPart part = GetPart(localID); | 122 | SceneObjectPart part = GetPart(localID); |
123 | if (part != null) | 123 | if (part == null) |
124 | { | 124 | { |
125 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 125 | m_log.ErrorFormat( |
126 | 126 | "[PRIM INVENTORY]: " + | |
127 | taskItem.ItemID = newItemId; | 127 | "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", |
128 | taskItem.AssetID = item.AssetID; | 128 | localID, Name, UUID, newItemId); |
129 | taskItem.Name = item.Name; | 129 | return false; |
130 | taskItem.Description = item.Description; | 130 | } |
131 | taskItem.OwnerID = part.OwnerID; // Transfer ownership | 131 | |
132 | taskItem.CreatorID = item.CreatorIdAsUuid; | 132 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
133 | taskItem.Type = item.AssetType; | 133 | |
134 | taskItem.InvType = item.InvType; | 134 | taskItem.ItemID = newItemId; |
135 | 135 | taskItem.AssetID = item.AssetID; | |
136 | if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) | 136 | taskItem.Name = item.Name; |
137 | { | 137 | taskItem.Description = item.Description; |
138 | taskItem.BasePermissions = item.BasePermissions & | 138 | taskItem.OwnerID = part.OwnerID; // Transfer ownership |
139 | item.NextPermissions; | 139 | taskItem.CreatorID = item.CreatorIdAsUuid; |
140 | taskItem.CurrentPermissions = item.CurrentPermissions & | 140 | taskItem.Type = item.AssetType; |
141 | item.NextPermissions; | 141 | taskItem.InvType = item.InvType; |
142 | taskItem.EveryonePermissions = item.EveryOnePermissions & | 142 | |
143 | item.NextPermissions; | 143 | if (agentID != part.OwnerID && m_scene.Permissions.PropagatePermissions()) |
144 | taskItem.GroupPermissions = item.GroupPermissions & | 144 | { |
145 | item.NextPermissions; | 145 | taskItem.BasePermissions = item.BasePermissions & |
146 | taskItem.NextPermissions = item.NextPermissions; | 146 | item.NextPermissions; |
147 | // We're adding this to a prim we don't own. Force | 147 | taskItem.CurrentPermissions = item.CurrentPermissions & |
148 | // owner change | 148 | item.NextPermissions; |
149 | taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | 149 | taskItem.EveryonePermissions = item.EveryOnePermissions & |
150 | } | 150 | item.NextPermissions; |
151 | else | 151 | taskItem.GroupPermissions = item.GroupPermissions & |
152 | { | 152 | item.NextPermissions; |
153 | taskItem.BasePermissions = item.BasePermissions; | 153 | taskItem.NextPermissions = item.NextPermissions; |
154 | taskItem.CurrentPermissions = item.CurrentPermissions; | 154 | // We're adding this to a prim we don't own. Force |
155 | taskItem.EveryonePermissions = item.EveryOnePermissions; | 155 | // owner change |
156 | taskItem.GroupPermissions = item.GroupPermissions; | 156 | taskItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; |
157 | taskItem.NextPermissions = item.NextPermissions; | 157 | |
158 | } | 158 | } |
159 | else | ||
160 | { | ||
161 | taskItem.BasePermissions = item.BasePermissions; | ||
162 | taskItem.CurrentPermissions = item.CurrentPermissions; | ||
163 | taskItem.EveryonePermissions = item.EveryOnePermissions; | ||
164 | taskItem.GroupPermissions = item.GroupPermissions; | ||
165 | taskItem.NextPermissions = item.NextPermissions; | ||
166 | } | ||
159 | 167 | ||
160 | taskItem.Flags = item.Flags; | 168 | taskItem.Flags = item.Flags; |
161 | 169 | ||
162 | // m_log.DebugFormat( | 170 | // m_log.DebugFormat( |
163 | // "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}", | 171 | // "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}", |
164 | // taskItem.Flags, taskItem.Name, localID, remoteClient.Name); | 172 | // taskItem.Flags, taskItem.Name, localID, remoteClient.Name); |
165 | 173 | ||
166 | // TODO: These are pending addition of those fields to TaskInventoryItem | 174 | // TODO: These are pending addition of those fields to TaskInventoryItem |
167 | // taskItem.SalePrice = item.SalePrice; | 175 | // taskItem.SalePrice = item.SalePrice; |
168 | // taskItem.SaleType = item.SaleType; | 176 | // taskItem.SaleType = item.SaleType; |
169 | taskItem.CreationDate = (uint)item.CreationDate; | 177 | taskItem.CreationDate = (uint)item.CreationDate; |
170 | 178 | ||
171 | bool addFromAllowedDrop = agentID != part.OwnerID; | 179 | bool addFromAllowedDrop; |
172 | 180 | if(withModRights) | |
173 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); | 181 | addFromAllowedDrop = false; |
174 | part.ParentGroup.AggregatePerms(); | ||
175 | return true; | ||
176 | } | ||
177 | else | 182 | else |
178 | { | 183 | addFromAllowedDrop = (part.ParentGroup.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0; |
179 | m_log.ErrorFormat( | 184 | |
180 | "[PRIM INVENTORY]: " + | 185 | part.Inventory.AddInventoryItem(taskItem, addFromAllowedDrop); |
181 | "Couldn't find prim local ID {0} in group {1}, {2} to add inventory item ID {3}", | 186 | part.ParentGroup.AggregatePerms(); |
182 | localID, Name, UUID, newItemId); | 187 | return true; |
183 | } | ||
184 | 188 | ||
185 | return false; | ||
186 | } | 189 | } |
187 | 190 | ||
188 | /// <summary> | 191 | /// <summary> |