From 32785921d0a4a074b92da0f4ec322cf451a4642f Mon Sep 17 00:00:00 2001 From: mingchen Date: Tue, 13 May 2008 16:22:57 +0000 Subject: *Complete redo of the permissions module *Removed hardcoded permissions checks *Added permissions checks where needed --- .../Region/Environment/Scenes/Scene.Inventory.cs | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 782d5b4..cbb3a7d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -988,17 +988,28 @@ namespace OpenSim.Region.Environment.Scenes } if (selectedEnt != null) { - bool permission; - if (DeRezPacket.AgentBlock.Destination == 1) - { // Take Copy - permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + bool permissionToTake = false; + bool permissionToDelete = false; + if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy + { + permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + permissionToDelete = false; //Just taking copy! + } - else - { // Take - permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + else if(DeRezPacket.AgentBlock.Destination == 4) //Take + { + // Take + permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); + permissionToDelete = permissionToTake; //If they can take, they can delete! + } + + else if (DeRezPacket.AgentBlock.Destination == 6) //Delete + { + permissionToTake = false; + permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); } - if (permission) + if (permissionToTake) { SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt; string sceneObjectXml = objectGroup.ToXmlString(); @@ -1044,8 +1055,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendInventoryItemCreateUpdate(item); } - // FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy - if (DeRezPacket.AgentBlock.Destination != 1) + if (permissionToDelete) { DeleteSceneObjectGroup(objectGroup); } -- cgit v1.1