diff options
author | UbitUmarov | 2017-01-11 01:02:57 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-11 01:02:57 +0000 |
commit | e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566 (patch) | |
tree | 32da77273f13f5e1511b2b31344f18585deecff0 | |
parent | remove obsolete PrimFlags.ObjectYouOfficer; rearrange GenerateClientFlags(...... (diff) | |
download | opensim-SC_OLD-e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566.zip opensim-SC_OLD-e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566.tar.gz opensim-SC_OLD-e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566.tar.bz2 opensim-SC_OLD-e0ab0b3b6b8ae45ff74c274d5af89ccc9bdb5566.tar.xz |
change GenerateClientFlags(...) to work with a scenepresence; make use of the new IsGod to check its God rights; remove the non standard estate manager right to move other ppl prims i added on last commits; coment out a test method i added sometime ago
4 files changed, 54 insertions, 20 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1267993..eedba9d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1112,7 +1112,7 @@ namespace OpenSim.Framework | |||
1112 | /// <param name="localID"></param> | 1112 | /// <param name="localID"></param> |
1113 | void SendKillObject(List<uint> localID); | 1113 | void SendKillObject(List<uint> localID); |
1114 | 1114 | ||
1115 | void SendPartFullUpdate(ISceneEntity ent, uint? parentID); | 1115 | // void SendPartFullUpdate(ISceneEntity ent, uint? parentID); |
1116 | 1116 | ||
1117 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); | 1117 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); |
1118 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); | 1118 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index df34668..8ba1ba3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4126,14 +4126,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4126 | // Vector3 mycamera = Vector3.Zero; | 4126 | // Vector3 mycamera = Vector3.Zero; |
4127 | Vector3 mypos = Vector3.Zero; | 4127 | Vector3 mypos = Vector3.Zero; |
4128 | ScenePresence mysp = (ScenePresence)SceneAgent; | 4128 | ScenePresence mysp = (ScenePresence)SceneAgent; |
4129 | if(mysp != null && !mysp.IsDeleted) | 4129 | |
4130 | // we should have a presence | ||
4131 | if(mysp == null) | ||
4132 | return; | ||
4133 | |||
4134 | if(doCulling) | ||
4130 | { | 4135 | { |
4131 | cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; | 4136 | cullingrange = mysp.DrawDistance + m_scene.ReprioritizationDistance + 16f; |
4132 | // mycamera = mysp.CameraPosition; | 4137 | // mycamera = mysp.CameraPosition; |
4133 | mypos = mysp.AbsolutePosition; | 4138 | mypos = mysp.AbsolutePosition; |
4134 | } | 4139 | } |
4135 | else | ||
4136 | doCulling = false; | ||
4137 | 4140 | ||
4138 | while (maxUpdatesBytes > 0) | 4141 | while (maxUpdatesBytes > 0) |
4139 | { | 4142 | { |
@@ -4330,7 +4333,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4330 | if (update.Entity is ScenePresence) | 4333 | if (update.Entity is ScenePresence) |
4331 | ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); | 4334 | ablock = CreateAvatarUpdateBlock((ScenePresence)update.Entity); |
4332 | else | 4335 | else |
4333 | ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId); | 4336 | ablock = CreatePrimUpdateBlock((SceneObjectPart)update.Entity, mysp); |
4334 | objectUpdateBlocks.Add(ablock); | 4337 | objectUpdateBlocks.Add(ablock); |
4335 | objectUpdates.Value.Add(update); | 4338 | objectUpdates.Value.Add(update); |
4336 | maxUpdatesBytes -= ablock.Length; | 4339 | maxUpdatesBytes -= ablock.Length; |
@@ -4462,6 +4465,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4462 | } | 4465 | } |
4463 | 4466 | ||
4464 | // hack.. dont use | 4467 | // hack.. dont use |
4468 | /* | ||
4465 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) | 4469 | public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) |
4466 | { | 4470 | { |
4467 | if (ent is SceneObjectPart) | 4471 | if (ent is SceneObjectPart) |
@@ -4472,7 +4476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4472 | packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); | 4476 | packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); |
4473 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 4477 | packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
4474 | 4478 | ||
4475 | ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); | 4479 | ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, mysp); |
4476 | if (parentID.HasValue) | 4480 | if (parentID.HasValue) |
4477 | { | 4481 | { |
4478 | blk.ParentID = parentID.Value; | 4482 | blk.ParentID = parentID.Value; |
@@ -4488,7 +4492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4488 | // updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); | 4492 | // updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name); |
4489 | // | 4493 | // |
4490 | } | 4494 | } |
4491 | 4495 | */ | |
4492 | public void ReprioritizeUpdates() | 4496 | public void ReprioritizeUpdates() |
4493 | { | 4497 | { |
4494 | lock (m_entityUpdates.SyncRoot) | 4498 | lock (m_entityUpdates.SyncRoot) |
@@ -5726,7 +5730,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5726 | return update; | 5730 | return update; |
5727 | } | 5731 | } |
5728 | 5732 | ||
5729 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID) | 5733 | // protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, UUID recipientID) |
5734 | protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SceneObjectPart data, ScenePresence sp) | ||
5730 | { | 5735 | { |
5731 | byte[] objectData = new byte[60]; | 5736 | byte[] objectData = new byte[60]; |
5732 | data.RelativePosition.ToBytes(objectData, 0); | 5737 | data.RelativePosition.ToBytes(objectData, 0); |
@@ -5826,12 +5831,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5826 | 5831 | ||
5827 | #region PrimFlags | 5832 | #region PrimFlags |
5828 | 5833 | ||
5829 | PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(recipientID, data.UUID); | 5834 | PrimFlags flags = (PrimFlags)m_scene.Permissions.GenerateClientFlags(sp, data.UUID); |
5830 | 5835 | ||
5831 | // Don't send the CreateSelected flag to everyone | 5836 | // Don't send the CreateSelected flag to everyone |
5832 | flags &= ~PrimFlags.CreateSelected; | 5837 | flags &= ~PrimFlags.CreateSelected; |
5833 | 5838 | ||
5834 | if (recipientID == data.OwnerID) | 5839 | if (sp.UUID == data.OwnerID) |
5835 | { | 5840 | { |
5836 | if (data.CreateSelected) | 5841 | if (data.CreateSelected) |
5837 | { | 5842 | { |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 1bb5181..495da8b 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -623,7 +623,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
623 | PrimFlags.ObjectOwnerModify | 623 | PrimFlags.ObjectOwnerModify |
624 | ); | 624 | ); |
625 | 625 | ||
626 | public uint GenerateClientFlags(UUID user, UUID objID) | 626 | public uint GenerateClientFlags(ScenePresence sp, UUID objID) |
627 | { | 627 | { |
628 | // ObjectFlags and Permission flags are two different enumerations | 628 | // ObjectFlags and Permission flags are two different enumerations |
629 | // ObjectFlags, tells the client what it will allow the user to do. | 629 | // ObjectFlags, tells the client what it will allow the user to do. |
@@ -641,8 +641,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
641 | 641 | ||
642 | objflags &= NOT_DEFAULT_FLAGS; | 642 | objflags &= NOT_DEFAULT_FLAGS; |
643 | 643 | ||
644 | // get a relevant class for current user on task | 644 | // get a relevant class for current presence on task |
645 | PermissionClass permissionClass = GetPermissionClass(user, task); | 645 | PermissionClass permissionClass = GetPermissionClass(sp, task); |
646 | 646 | ||
647 | // handle acording | 647 | // handle acording |
648 | uint returnMask = 0; | 648 | uint returnMask = 0; |
@@ -668,10 +668,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
668 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | 668 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); |
669 | if (task.OwnerID != UUID.Zero) | 669 | if (task.OwnerID != UUID.Zero) |
670 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 670 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; |
671 | |||
672 | // allow estatemanagers to move prims to help solve disputes | ||
673 | if(!task.ParentGroup.IsAttachment && IsEstateManager(user)) | ||
674 | returnMask |= (uint)PrimFlags.ObjectMove; | ||
675 | break; | 671 | break; |
676 | } | 672 | } |
677 | return returnMask; | 673 | return returnMask; |
@@ -705,6 +701,39 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
705 | return objectFlagsMask; | 701 | return objectFlagsMask; |
706 | } | 702 | } |
707 | 703 | ||
704 | private PermissionClass GetPermissionClass(ScenePresence sp, SceneObjectPart obj) | ||
705 | { | ||
706 | if (obj == null || sp == null) | ||
707 | return PermissionClass.Everyone; | ||
708 | |||
709 | if (m_bypassPermissions) | ||
710 | return PermissionClass.Owner; | ||
711 | |||
712 | |||
713 | if (sp.IsGod) | ||
714 | return PermissionClass.Owner; | ||
715 | |||
716 | UUID user = sp.UUID; | ||
717 | |||
718 | // Object owners should be able to edit their own content | ||
719 | UUID objectOwner = obj.OwnerID; | ||
720 | if (user == objectOwner) | ||
721 | return PermissionClass.Owner; | ||
722 | |||
723 | if(!obj.ParentGroup.IsAttachment) | ||
724 | { | ||
725 | if (IsFriendWithPerms(user, objectOwner) ) | ||
726 | return PermissionClass.Owner; | ||
727 | |||
728 | // Group permissions | ||
729 | if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0)) | ||
730 | return PermissionClass.Group; | ||
731 | } | ||
732 | |||
733 | return PermissionClass.Everyone; | ||
734 | } | ||
735 | |||
736 | // OARs need this method that handles offline users | ||
708 | public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj) | 737 | public PermissionClass GetPermissionClass(UUID user, SceneObjectPart obj) |
709 | { | 738 | { |
710 | if (obj == null) | 739 | if (obj == null) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e97e494..c4cb6c7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | namespace OpenSim.Region.Framework.Scenes | 37 | namespace OpenSim.Region.Framework.Scenes |
38 | { | 38 | { |
39 | #region Delegates | 39 | #region Delegates |
40 | public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); | 40 | public delegate uint GenerateClientFlagsHandler(ScenePresence sp, UUID objectID); |
41 | public delegate void SetBypassPermissionsHandler(bool value); | 41 | public delegate void SetBypassPermissionsHandler(bool value); |
42 | public delegate bool BypassPermissionsHandler(); | 42 | public delegate bool BypassPermissionsHandler(); |
43 | public delegate bool PropagatePermissionsHandler(); | 43 | public delegate bool PropagatePermissionsHandler(); |
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
167 | 167 | ||
168 | #region Object Permission Checks | 168 | #region Object Permission Checks |
169 | 169 | ||
170 | public uint GenerateClientFlags(UUID userID, UUID objectID) | 170 | public uint GenerateClientFlags(ScenePresence sp, UUID objectID) |
171 | { | 171 | { |
172 | // libomv will moan about PrimFlags.ObjectYouOfficer being | 172 | // libomv will moan about PrimFlags.ObjectYouOfficer being |
173 | // obsolete... | 173 | // obsolete... |
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
195 | Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); | 195 | Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); |
196 | foreach (GenerateClientFlagsHandler check in list) | 196 | foreach (GenerateClientFlagsHandler check in list) |
197 | { | 197 | { |
198 | perms &= check(userID, objectID); | 198 | perms &= check(sp, objectID); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | return perms; | 201 | return perms; |