From bb824eadeeb2b35025954d0c97f15123c6fd0cbe Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 5 Dec 2007 06:44:32 +0000 Subject: * Refactored Permissions into ScenePresence as requested by MW * Un-hackerized generating the client_flags * Now handling the ObjectPermissions Update packet * Warning: Backup your prim before updating. If you fail to do so and something goes wrong then, All Yr prim are belong to us! --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 4 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 49 ++-- .../Region/Environment/Scenes/SceneObjectGroup.cs | 33 ++- .../Region/Environment/Scenes/SceneObjectPart.cs | 270 +++++++++++++-------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 9 +- 6 files changed, 236 insertions(+), 130 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 2511baf..4c168b3 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -555,7 +555,7 @@ namespace OpenSim.Region.Environment.Scenes public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - if (PermissionsMngr.CanEditObject(remoteClient.AgentId, objectID)) + if (PermissionsMngr.CanEditObject(remoteClient.AgentId, objectID) || PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, objectID)) { SceneObjectGroup group = GetGroupByPrim(objectID); if (group != null) @@ -729,7 +729,7 @@ namespace OpenSim.Region.Environment.Scenes if (originPrim != null) { - if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID)) + if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID) || PermissionsMngr.AnyoneCanCopyPermission(AgentID, originPrim.UUID)) { SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID); copy.AbsolutePosition = copy.AbsolutePosition + offset; diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index f518d63..cf845a6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -543,6 +543,7 @@ namespace OpenSim.Region.Environment.Scenes AddEntity(group); group.AbsolutePosition = pos; SceneObjectPart rootPart = group.GetChildPart(group.UUID); + rootPart.ApplySanePermissions(); bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f9cace2..1f43f53 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -733,20 +733,8 @@ namespace OpenSim.Region.Environment.Scenes { AddEntityFromStorage(prim); SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); - if (m_permissions) - { - rootPart.EveryoneMask = rootPart.ObjectFlags; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; - rootPart.EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; - } - else - { - rootPart.EveryoneMask = rootPart.ObjectFlags; - } + rootPart.ApplySanePermissions(); + bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) rootPart.PhysActor = PhysicsScene.AddPrimShape( @@ -839,6 +827,7 @@ namespace OpenSim.Region.Environment.Scenes AddEntity(sceneOb); SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); // if grass or tree, make phantom + //rootPart.ApplySanePermissions(); if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) { rootPart.AddFlag(LLObject.ObjectFlags.Phantom); @@ -983,6 +972,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); client.OnRequestGodlikePowers += handleRequestGodlikePowers; client.OnGodKickUser += handleGodlikeKickUser; + client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; @@ -1404,16 +1394,16 @@ namespace OpenSim.Region.Environment.Scenes { if (godid == RegionInfo.MasterAvatarAssignedUUID) { - if (agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) + if (agentid == new LLUUID("44e87126e7944ded05b37c42da3d5cdb")) { - - ClientManager.ForEachClient(delegate (IClientAPI controller) + + ClientManager.ForEachClient(delegate(IClientAPI controller) { ScenePresence p = GetScenePresence(controller.AgentId); bool childagent = false; if (!p.Equals(null)) if (p.IsChildAgent) - childagent=true; + childagent = true; if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? { controller.Kick(Helpers.FieldToUTF8String(reason)); @@ -1424,7 +1414,7 @@ namespace OpenSim.Region.Environment.Scenes // This is a bit crude. It seems the client will be null before it actually stops the thread // The thread will kill itself eventually :/ // Is there another way to make sure *all* clients get this 'inter region' message? - ClientManager.ForEachClient(delegate (IClientAPI controller) + ClientManager.ForEachClient(delegate(IClientAPI controller) { ScenePresence p = GetScenePresence(controller.AgentId); bool childagent = false; @@ -1439,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes } ); } - else + else { m_scenePresences[agentid].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); m_scenePresences[agentid].ControllingClient.Close(); @@ -1452,7 +1442,26 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void HandleObjectPermissionsUpdate (IClientAPI controller, LLUUID AgentID, LLUUID SessionID, List permChanges) + { + // Check for spoofing.. since this is permissions we're talking about here! + if ((controller.SessionId == SessionID) && (controller.AgentId == AgentID)) + { + for (int i = 0; i < permChanges.Count; i++) + { + + // Tell the object to do permission update + byte field = permChanges[i].Field; + uint localID = permChanges[i].ObjectLocalID; + uint mask = permChanges[i].Mask; + byte addRemTF = permChanges[i].Set; + SceneObjectGroup chObjectGroup = GetGroupByPrim(localID); + chObjectGroup.UpdatePermissions(AgentID, field, localID, mask, addRemTF); + } + } + + } public void SendAlertToUser(string firstName, string lastName, string message, bool modal) { foreach (ScenePresence presence in m_scenePresences.Values) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index fe135de..d2cf2a3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -283,7 +283,7 @@ namespace OpenSim.Region.Environment.Scenes AddPart(part); part.RegionHandle = m_regionHandle; - part.ApplyPermissions(); + part.ApplySanePermissions(); } break; case XmlNodeType.EndElement: @@ -530,7 +530,7 @@ namespace OpenSim.Region.Environment.Scenes dupe.m_regionHandle = m_regionHandle; dupe.CopyRootPart(m_rootPart, OwnerID, GroupID); - + dupe.m_rootPart.ApplySanePermissions(); /// may need to create a new Physics actor. if (dupe.RootPart.PhysActor != null) @@ -555,6 +555,8 @@ namespace OpenSim.Region.Environment.Scenes // So, we have to make a copy of this one, set it in it's place then set the owner on this one SetRootPartOwner(m_rootPart, cAgentID, cGroupID); + + m_rootPart.ScheduleFullUpdate(); List partList = new List(m_parts.Values); @@ -592,6 +594,15 @@ namespace OpenSim.Region.Environment.Scenes part.LastOwnerID = part.OwnerID; part.OwnerID = cAgentID; part.GroupID = cGroupID; + + + if (part.OwnerID != cAgentID) + { + // Apply Next Owner Permissions if we're not bypassing permissions + if (!m_scene.PermissionsMngr.BypassPermissions) + m_rootPart.ApplyNextOwnerPermissions(); + } + part.ScheduleFullUpdate(); } @@ -1224,6 +1235,14 @@ namespace OpenSim.Region.Environment.Scenes } } + public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) + { + SceneObjectPart updatePart = GetChildPart(localID); + updatePart.UpdatePermissions(AgentID,field,localID,mask,addRemTF); + } + + + #endregion #region Shape @@ -1514,13 +1533,13 @@ namespace OpenSim.Region.Environment.Scenes #region Client Updating - public void SendFullUpdateToClient(IClientAPI remoteClient) + public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientFlags) { lock (m_parts) { foreach (SceneObjectPart part in m_parts.Values) { - SendPartFullUpdate(remoteClient, part); + SendPartFullUpdate(remoteClient, part, clientFlags); } } } @@ -1530,15 +1549,15 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part) + internal void SendPartFullUpdate(IClientAPI remoteClient, SceneObjectPart part, uint clientFlags) { if (m_rootPart.UUID == part.UUID) { - part.SendFullUpdateToClient(remoteClient, AbsolutePosition); + part.SendFullUpdateToClient(remoteClient, AbsolutePosition, clientFlags); } else { - part.SendFullUpdateToClient(remoteClient); + part.SendFullUpdateToClient(remoteClient, clientFlags); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 19405fc..238e78a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -44,8 +44,12 @@ namespace OpenSim.Region.Environment.Scenes { public class SceneObjectPart : IScriptHost { - private const uint FULL_MASK_PERMISSIONS = 2147483647; - + private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer; + private const LLObject.ObjectFlags OBJFULL_MASK_OWNER = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify | LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner; + private const uint OBJNEXT_OWNER = 2147483647; + + private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; + private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; private string m_inventoryFileName = ""; private LLUUID m_folderID = LLUUID.Zero; @@ -64,11 +68,13 @@ namespace OpenSim.Region.Environment.Scenes public Int32 CreationDate; public uint ParentID = 0; - public uint OwnerMask = FULL_MASK_PERMISSIONS; - public uint NextOwnerMask = FULL_MASK_PERMISSIONS; - public uint GroupMask = FULL_MASK_PERMISSIONS; - public uint EveryoneMask = FULL_MASK_PERMISSIONS; - public uint BaseMask = FULL_MASK_PERMISSIONS; + // Main grid has default permissions as follows + // + public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; + public uint NextOwnerMask = OBJNEXT_OWNER; + public uint GroupMask = (uint) LLObject.ObjectFlags.None; + public uint EveryoneMask = (uint) LLObject.ObjectFlags.None; + public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER; protected byte[] m_particleSystem = new byte[0]; @@ -463,17 +469,11 @@ namespace OpenSim.Region.Environment.Scenes m_folderID = LLUUID.Random(); m_flags = 0; - m_flags |= LLObject.ObjectFlags.ObjectModify | - LLObject.ObjectFlags.ObjectCopy | - LLObject.ObjectFlags.ObjectYouOwner | - LLObject.ObjectFlags.Touch | - LLObject.ObjectFlags.ObjectMove | - LLObject.ObjectFlags.AllowInventoryDrop | - LLObject.ObjectFlags.ObjectTransfer | - LLObject.ObjectFlags.CreateSelected | - LLObject.ObjectFlags.ObjectOwnerModify; - - ApplyPermissions(); + m_flags |= LLObject.ObjectFlags.Touch | + LLObject.ObjectFlags.AllowInventoryDrop | + LLObject.ObjectFlags.CreateSelected; + + ApplySanePermissions(); ScheduleFullUpdate(); } @@ -511,7 +511,7 @@ namespace OpenSim.Region.Environment.Scenes RotationOffset = rotation; ObjectFlags = flags; - ApplyPermissions(); + ApplySanePermissions(); // ApplyPhysics(); ScheduleFullUpdate(); @@ -552,24 +552,99 @@ namespace OpenSim.Region.Environment.Scenes DoPhysicsPropertyUpdate(usePhysics, true); } + public void ApplyNextOwnerPermissions() + { + BaseMask = NextOwnerMask; + OwnerMask = NextOwnerMask; + } + public void ApplySanePermissions() + { + // These are some flags that The OwnerMask should never have + OwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; + OwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; + OwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; + OwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; + OwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; + OwnerMask &= ~(uint)LLObject.ObjectFlags.Money; + OwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; + OwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; + OwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; + + + // These are some flags that the next owner mask should never have + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Money; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; + NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; + + + // These are some flags that the GroupMask should never have + GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; + GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; + GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; + GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; + GroupMask &= ~(uint)LLObject.ObjectFlags.Physics; + GroupMask &= ~(uint)LLObject.ObjectFlags.Phantom; + GroupMask &= ~(uint)LLObject.ObjectFlags.Scripted; + GroupMask &= ~(uint)LLObject.ObjectFlags.Touch; + GroupMask &= ~(uint)LLObject.ObjectFlags.Temporary; + GroupMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; + GroupMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; + GroupMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; + GroupMask &= ~(uint)LLObject.ObjectFlags.AnimSource; + GroupMask &= ~(uint)LLObject.ObjectFlags.Money; + GroupMask &= ~(uint)LLObject.ObjectFlags.CastShadows; + GroupMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; + GroupMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; + + + // These are some flags that EveryoneMask should never have + EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Physics; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Phantom; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Scripted; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Touch; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Temporary; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.AnimSource; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.Money; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.CastShadows; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; + EveryoneMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; + + + // These are some flags that ObjectFlags (m_flags) should never have + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; + ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; - public void ApplyPermissions() - { - if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) - { - EveryoneMask = ObjectFlags; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectCopy; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectMove; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectAnyOwner; - EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; - } - else - { - EveryoneMask = ObjectFlags; - } } /// @@ -774,9 +849,7 @@ namespace OpenSim.Region.Environment.Scenes { //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); m_flags |= flag; - BaseMask |= (uint)flag; - GroupMask |= (uint)flag; - EveryoneMask |= (uint)flag; + } uint currflag = (uint)m_flags; //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); @@ -790,9 +863,7 @@ namespace OpenSim.Region.Environment.Scenes { //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); m_flags &= ~flag; - BaseMask &= ~(uint)flag; - GroupMask &= ~(uint)flag; - EveryoneMask &= ~(uint)flag; + } //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); //ScheduleFullUpdate(); @@ -1198,6 +1269,51 @@ namespace OpenSim.Region.Environment.Scenes #endregion + public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) + { + // Are we the owner? + if (AgentID == OwnerID) + { + MainLog.Instance.Verbose("PERMISSIONS", "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + addRemTF.ToString()); + + //Field 8 = EveryoneMask + if (field == (byte)8) + { + MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask)); + if (addRemTF == (byte)0) + { + //EveryoneMask = (uint)0; + EveryoneMask &= ~mask; + //EveryoneMask &= ~(uint)57344; + + + } + else + { + //EveryoneMask = (uint)0; + EveryoneMask |= mask; + //EveryoneMask |= (uint)57344; + + } + ScheduleFullUpdate(); + } + //Field 16 = NextownerMask + if (field == (byte)16) + { + if (addRemTF == (byte)0) + { + NextOwnerMask &= ~mask; + } + else + { + NextOwnerMask |= mask; + } + ScheduleFullUpdate(); + } + + } + } + #region Client Update Methods public void AddFullUpdateToAllAvatars() @@ -1222,7 +1338,8 @@ namespace OpenSim.Region.Environment.Scenes List avatars = m_parentGroup.GetScenePresences(); for (int i = 0; i < avatars.Count; i++) { - m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); + // Ugly reference :( + m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, avatars[i].GenerateClientFlags(this.UUID)); } } @@ -1230,20 +1347,20 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void SendFullUpdate(IClientAPI remoteClient) + public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags) { - m_parentGroup.SendPartFullUpdate(remoteClient, this); + m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags); } /// /// /// /// - public void SendFullUpdateToClient(IClientAPI remoteClient) + public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags) { LLVector3 lPos; lPos = OffsetPosition; - SendFullUpdateToClient(remoteClient, lPos); + SendFullUpdateToClient(remoteClient, lPos, clientflags); } /// @@ -1251,56 +1368,13 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) + public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags) { LLQuaternion lRot; lRot = RotationOffset; - uint clientFlags = ObjectFlags & ~(uint)LLObject.ObjectFlags.CreateSelected; - - List avatars = m_parentGroup.GetScenePresences(); - foreach (ScenePresence s in avatars) + if (remoteClient.AgentId == OwnerID) { - if (s.m_uuid == OwnerID) - { - if (s.ControllingClient == remoteClient) - { - clientFlags = ObjectFlags; - m_flags &= ~LLObject.ObjectFlags.CreateSelected; - } - break; - } - } - // If you can't edit it, send the base permissions minus the flag to edit - - - // We're going to be moving this into ScenePresence and the PermissionsManager itself. - if (!ParentGroup.m_scene.PermissionsMngr.BypassPermissions) - { - if (ParentGroup.m_scene.PermissionsMngr.CanEditObject(remoteClient.AgentId, this.ParentGroup.UUID)) - { - // we should be merging the objectflags with the ownermask here. - // TODO: Future refactoring here. - clientFlags = ObjectFlags; - - } - else - { - //clientFlags = ObjectFlags; - clientFlags = EveryoneMask; - if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanCopyPermission(remoteClient.AgentId, this.ParentGroup.UUID)) - { - clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; - } - - if (!ParentGroup.m_scene.PermissionsMngr.AnyoneCanMovePermission(remoteClient.AgentId, this.ParentGroup.UUID)) - { - clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove; - } - - clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify; - clientFlags &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; - clientFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; - } + clientFlags &= ~(uint)LLObject.ObjectFlags.CreateSelected; } @@ -1479,11 +1553,11 @@ namespace OpenSim.Region.Environment.Scenes public LLUUID item_id = LLUUID.Zero; public LLUUID parent_id = LLUUID.Zero; //parent folder id - public uint base_mask = FULL_MASK_PERMISSIONS; - public uint owner_mask = FULL_MASK_PERMISSIONS; - public uint group_mask = FULL_MASK_PERMISSIONS; - public uint everyone_mask = FULL_MASK_PERMISSIONS; - public uint next_owner_mask = FULL_MASK_PERMISSIONS; + public uint base_mask = FULL_MASK_PERMISSIONS_GENERAL; + public uint owner_mask = FULL_MASK_PERMISSIONS_GENERAL; + public uint group_mask = FULL_MASK_PERMISSIONS_GENERAL; + public uint everyone_mask = FULL_MASK_PERMISSIONS_GENERAL; + public uint next_owner_mask = FULL_MASK_PERMISSIONS_GENERAL; public LLUUID creator_id = LLUUID.Zero; public LLUUID owner_id = LLUUID.Zero; public LLUUID last_owner_id = LLUUID.Zero; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 524fb60..2f00515 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -343,7 +343,10 @@ namespace OpenSim.Region.Environment.Scenes } // } } - + public uint GenerateClientFlags(LLUUID ObjectID) + { + return m_scene.PermissionsMngr.GenerateClientFlags(this.m_uuid, ObjectID); + } public void SendPrimUpdates() { // if (m_scene.QuadTree.GetNodeID(this.AbsolutePosition.X, this.AbsolutePosition.Y) != m_currentQuadNode) @@ -380,7 +383,7 @@ namespace OpenSim.Region.Environment.Scenes if (update.LastFullUpdateTime < part.TimeStampFull) { //need to do a full update - part.SendFullUpdate(ControllingClient); + part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); // We'll update to the part's timestamp rather than the current to // avoid the race condition whereby the next tick occurs while we are @@ -403,7 +406,7 @@ namespace OpenSim.Region.Environment.Scenes else { //never been sent to client before so do full update - part.SendFullUpdate(ControllingClient); + part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); ScenePartUpdate update = new ScenePartUpdate(); update.FullID = part.UUID; update.LastFullUpdateTime = part.TimeStampFull; -- cgit v1.1