From 4bd38fc65a77826c5646c3154d087171c290cbed Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 29 Nov 2007 15:24:31 +0000 Subject: * Thanks to _SomeOne_, Server side permissions on object editing. Be aware, that if you're editing an object on your client that you're not allowed to, it'll appear that it's moving to you, but won't actually be moving on the sim. --- OpenSim/Framework/IClientAPI.cs | 4 +- OpenSim/Region/ClientStack/ClientView.cs | 171 ++++++++++++------------ OpenSim/Region/Environment/PermissionManager.cs | 8 +- OpenSim/Region/Environment/Scenes/InnerScene.cs | 19 ++- 4 files changed, 110 insertions(+), 92 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index e94b9aa..0068761 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -211,9 +211,9 @@ namespace OpenSim.Framework public delegate void GenericCall7(uint localID, string message); - public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); + public delegate void UpdateShape(LLUUID agentID, uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); - public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); + public delegate void ObjectExtraParams(LLUUID agentID, uint localID, ushort type, bool inUse, byte[] data); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index f9c1ff1..8b93c5f 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -2014,116 +2014,121 @@ namespace OpenSim.Region.ClientStack { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet; // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); + OpenSim.Region.Environment.Scenes.Scene tScene = (OpenSim.Region.Environment.Scenes.Scene)this.m_scene; + for (int i = 0; i < multipleupdate.ObjectData.Length; i++) { - #region position - - if (multipleupdate.ObjectData[i].Type == 9) //change position + if (tScene.PermissionsMngr.CanEditObject(simClient.AgentId, tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID)) { - if (OnUpdatePrimGroupPosition != null) + #region position + + if (multipleupdate.ObjectData[i].Type == 9) //change position { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + if (OnUpdatePrimGroupPosition != null) + { + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + OnUpdatePrimGroupPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position - { - if (OnUpdatePrimSinglePosition != null) + else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + if (OnUpdatePrimSinglePosition != null) + { + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } } - } #endregion position #region rotation - else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab - { - if (OnUpdatePrimSingleRotation != null) + else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + if (OnUpdatePrimSingleRotation != null) + { + LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + //System.Console.WriteLine("new tab rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse - { - if (OnUpdatePrimSingleRotation != null) + else if (multipleupdate.ObjectData[i].Type == 3) // single item of group rotation from mouse { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); - //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + if (OnUpdatePrimSingleRotation != null) + { + LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); + //System.Console.WriteLine("new mouse rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimSingleRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab - { - if (OnUpdatePrimGroupRotation != null) + else if (multipleupdate.ObjectData[i].Type == 10) //group rotation from object tab { - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + if (OnUpdatePrimGroupRotation != null) + { + LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse - { - if (OnUpdatePrimGroupMouseRotation != null) + else if (multipleupdate.ObjectData[i].Type == 11) //group rotation from mouse { - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); - //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); - OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); + if (OnUpdatePrimGroupMouseRotation != null) + { + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); + //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); + OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); + } } - } #endregion #region scale - else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab - { - if (OnUpdatePrimScale != null) + else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - - // Change the position based on scale (for bug number 246) - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + + // Change the position based on scale (for bug number 246) + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + // System.Console.WriteLine("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); + OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse - { - if (OnUpdatePrimScale != null) + else if (multipleupdate.ObjectData[i].Type == 29) //group scale from mouse { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); - LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); - OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z ); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); + OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab - { - if (OnUpdatePrimScale != null) + else if (multipleupdate.ObjectData[i].Type == 5) //single prim scale from object tab { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } } - } - else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse - { - if (OnUpdatePrimScale != null) + else if (multipleupdate.ObjectData[i].Type == 21) //single prim scale from mouse { - LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); - // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + if (OnUpdatePrimScale != null) + { + LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); + // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); + } } - } - #endregion + #endregion + } } return true; } @@ -2757,7 +2762,7 @@ namespace OpenSim.Region.ClientStack { if (OnUpdatePrimShape != null) { - OnUpdatePrimShape(shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); + OnUpdatePrimShape(this.m_agentId, shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); } } break; @@ -2765,7 +2770,7 @@ namespace OpenSim.Region.ClientStack ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack; if (OnUpdateExtraParams != null) { - OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, + OnUpdateExtraParams(this.m_agentId, extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); } break; @@ -3642,4 +3647,4 @@ namespace OpenSim.Region.ClientStack OutPacket(logReply, ThrottleOutPacketType.Task); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs index 6efa116..bcaa1bf 100644 --- a/OpenSim/Region/Environment/PermissionManager.cs +++ b/OpenSim/Region/Environment/PermissionManager.cs @@ -103,6 +103,12 @@ namespace OpenSim.Region.Environment string reason = "Insufficient permission"; + Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y); + if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects) + permission = true; + + //TODO: check for group rights + if (IsAdministrator(user)) { permission = true; @@ -361,4 +367,4 @@ namespace OpenSim.Region.Environment #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index c1acde4..0cb17c0 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -589,11 +589,14 @@ namespace OpenSim.Region.Environment.Scenes group.SetPartDescription(description, primLocalID); } - public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data) + public void UpdateExtraParam(LLUUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data) { SceneObjectGroup group = GetGroupByPrim(primLocalID); - if (group != null) - group.UpdateExtraParam(primLocalID, type, inUse, data); + if (this.m_parentScene.PermissionsMngr.CanEditObject(agentID, group.GetPartsFullID(primLocalID))) + { + if (group != null) + group.UpdateExtraParam(primLocalID, type, inUse, data); + } } /// @@ -601,11 +604,14 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) + public void UpdatePrimShape(LLUUID agentID, uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) { SceneObjectGroup group = GetGroupByPrim(primLocalID); - if (group != null) - group.UpdateShape(shapeBlock, primLocalID); + if (this.m_parentScene.PermissionsMngr.CanEditObject(agentID, group.GetPartsFullID(primLocalID))) + { + if (group != null) + group.UpdateShape(shapeBlock, primLocalID); + } } /// @@ -753,3 +759,4 @@ namespace OpenSim.Region.Environment.Scenes } } + -- cgit v1.1