diff options
author | Melanie Thielker | 2017-01-13 17:09:26 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-13 17:09:26 +0000 |
commit | b9eb3afb62c27c3a66ece205542075b609507685 (patch) | |
tree | 6d54aeeca8ce9d2b0a9e47bb9d368b23ad73f960 /OpenSim | |
parent | Harmonize case in Permissions enum (diff) | |
parent | Add permission CanChangeSelectedState replacing 2 calls to check Move and Mod... (diff) | |
download | opensim-SC-b9eb3afb62c27c3a66ece205542075b609507685.zip opensim-SC-b9eb3afb62c27c3a66ece205542075b609507685.tar.gz opensim-SC-b9eb3afb62c27c3a66ece205542075b609507685.tar.bz2 opensim-SC-b9eb3afb62c27c3a66ece205542075b609507685.tar.xz |
Merge branch 'master' of opensimulator.org:/var/git/opensim
Diffstat (limited to '')
3 files changed, 68 insertions, 49 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 094da2b..b60cd93 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -592,10 +592,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
592 | 592 | ||
593 | protected bool IsFriendWithPerms(UUID user, UUID objectOwner) | 593 | protected bool IsFriendWithPerms(UUID user, UUID objectOwner) |
594 | { | 594 | { |
595 | if (user == UUID.Zero) | 595 | if (FriendsModule == null) |
596 | return false; | 596 | return false; |
597 | 597 | ||
598 | if (FriendsModule == null) | 598 | if (user == UUID.Zero) |
599 | return false; | 599 | return false; |
600 | 600 | ||
601 | int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner); | 601 | int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner); |
@@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
684 | // gods have owner rights with Modify and Move always on | 684 | // gods have owner rights with Modify and Move always on |
685 | if(sp.IsGod) | 685 | if(sp.IsGod) |
686 | { | 686 | { |
687 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | 687 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true); |
688 | returnMask |= EXTRAGODMASK; | 688 | returnMask |= EXTRAGODMASK; |
689 | return returnMask; | 689 | return returnMask; |
690 | } | 690 | } |
@@ -692,20 +692,22 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
692 | //bypass option == owner rights | 692 | //bypass option == owner rights |
693 | if (m_bypassPermissions) | 693 | if (m_bypassPermissions) |
694 | { | 694 | { |
695 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | 695 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, true); |
696 | returnMask |= EXTRAOWNERMASK; | 696 | returnMask |= EXTRAOWNERMASK; |
697 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) | 697 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) |
698 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; | 698 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; |
699 | return returnMask; | 699 | return returnMask; |
700 | } | 700 | } |
701 | 701 | ||
702 | bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0; | ||
703 | |||
702 | UUID taskOwnerID = task.OwnerID; | 704 | UUID taskOwnerID = task.OwnerID; |
703 | UUID spID = sp.UUID; | 705 | UUID spID = sp.UUID; |
704 | 706 | ||
705 | // owner | 707 | // owner |
706 | if (spID == taskOwnerID) | 708 | if (spID == taskOwnerID) |
707 | { | 709 | { |
708 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | 710 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked); |
709 | returnMask |= EXTRAOWNERMASK; | 711 | returnMask |= EXTRAOWNERMASK; |
710 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) | 712 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) |
711 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; | 713 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; |
@@ -715,16 +717,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
715 | // if not god or owner, do attachments as everyone | 717 | // if not god or owner, do attachments as everyone |
716 | if(task.ParentGroup.IsAttachment) | 718 | if(task.ParentGroup.IsAttachment) |
717 | { | 719 | { |
718 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | 720 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked); |
719 | if (taskOwnerID != UUID.Zero) | 721 | if (taskOwnerID != UUID.Zero) |
720 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 722 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; |
721 | return returnMask; | 723 | return returnMask; |
722 | } | 724 | } |
723 | 725 | ||
726 | UUID taskGroupID = task.GroupID; | ||
727 | bool groupdOwned = taskOwnerID == taskGroupID; | ||
728 | |||
724 | // if friends with rights then owner | 729 | // if friends with rights then owner |
725 | if (IsFriendWithPerms(spID, taskOwnerID)) | 730 | if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID)) |
726 | { | 731 | { |
727 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | 732 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked); |
728 | returnMask |= EXTRAOWNERMASK; | 733 | returnMask |= EXTRAOWNERMASK; |
729 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) | 734 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) |
730 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; | 735 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; |
@@ -732,18 +737,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
732 | } | 737 | } |
733 | 738 | ||
734 | // group owned or shared ? | 739 | // group owned or shared ? |
735 | UUID taskGroupID = task.GroupID; | ||
736 | IClientAPI client = sp.ControllingClient; | 740 | IClientAPI client = sp.ControllingClient; |
737 | if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID)) | 741 | if(taskGroupID != UUID.Zero && client != null && client.IsGroupMember(taskGroupID)) |
738 | { | 742 | { |
739 | if(taskGroupID == taskOwnerID) | 743 | if(groupdOwned) |
740 | { | 744 | { |
741 | // object is owned by group, owner rights and group role powers do apply | 745 | // object is owned by group, check role powers |
742 | if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0) | 746 | if((client.GetGroupPowers(taskGroupID) & (ulong)GroupPowers.ObjectManipulate) != 0) |
743 | // instead forcing active group can be safeguard againts casual mistakes ?? | ||
744 | //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate)) | ||
745 | { | 747 | { |
746 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | 748 | returnMask = ApplyObjectModifyMasks(task.OwnerMask, objflags, unlocked); |
747 | returnMask |= | 749 | returnMask |= |
748 | (uint)PrimFlags.ObjectGroupOwned | | 750 | (uint)PrimFlags.ObjectGroupOwned | |
749 | (uint)PrimFlags.ObjectAnyOwner; | 751 | (uint)PrimFlags.ObjectAnyOwner; |
@@ -753,16 +755,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
753 | } | 755 | } |
754 | else | 756 | else |
755 | { | 757 | { |
756 | // no special rights | 758 | // group sharing or everyone |
757 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | 759 | returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked); |
758 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 760 | returnMask |= |
761 | (uint)PrimFlags.ObjectGroupOwned | | ||
762 | (uint)PrimFlags.ObjectAnyOwner; | ||
759 | return returnMask; | 763 | return returnMask; |
760 | } | 764 | } |
761 | } | 765 | } |
762 | else | 766 | else |
763 | { | 767 | { |
764 | // group sharing | 768 | // group sharing or everyone |
765 | returnMask = ApplyObjectModifyMasks(task.GroupMask, objflags); | 769 | returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked); |
766 | if (taskOwnerID != UUID.Zero) | 770 | if (taskOwnerID != UUID.Zero) |
767 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 771 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; |
768 | return returnMask; | 772 | return returnMask; |
@@ -770,13 +774,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
770 | } | 774 | } |
771 | 775 | ||
772 | // fallback is everyone rights | 776 | // fallback is everyone rights |
773 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | 777 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked); |
774 | if (taskOwnerID != UUID.Zero) | 778 | if (taskOwnerID != UUID.Zero) |
775 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 779 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; |
776 | return returnMask; | 780 | return returnMask; |
777 | } | 781 | } |
778 | 782 | ||
779 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) | 783 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool unlocked) |
780 | { | 784 | { |
781 | // We are adding the temporary objectflags to the object's objectflags based on the | 785 | // We are adding the temporary objectflags to the object's objectflags based on the |
782 | // permission flag given. These change the F flags on the client. | 786 | // permission flag given. These change the F flags on the client. |
@@ -786,14 +790,17 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
786 | objectFlagsMask |= (uint)PrimFlags.ObjectCopy; | 790 | objectFlagsMask |= (uint)PrimFlags.ObjectCopy; |
787 | } | 791 | } |
788 | 792 | ||
789 | if ((setPermissionMask & (uint)PermissionMask.Move) != 0) | 793 | if (unlocked) |
790 | { | 794 | { |
791 | objectFlagsMask |= (uint)PrimFlags.ObjectMove; | 795 | if ((setPermissionMask & (uint)PermissionMask.Move) != 0) |
792 | } | 796 | { |
797 | objectFlagsMask |= (uint)PrimFlags.ObjectMove; | ||
798 | } | ||
793 | 799 | ||
794 | if ((setPermissionMask & (uint)PermissionMask.Modify) != 0) | 800 | if ((setPermissionMask & (uint)PermissionMask.Modify) != 0) |
795 | { | 801 | { |
796 | objectFlagsMask |= (uint)PrimFlags.ObjectModify; | 802 | objectFlagsMask |= (uint)PrimFlags.ObjectModify; |
803 | } | ||
797 | } | 804 | } |
798 | 805 | ||
799 | if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0) | 806 | if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0) |
@@ -1559,35 +1566,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1559 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) | 1566 | private bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition, Scene scene) |
1560 | { | 1567 | { |
1561 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1568 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1562 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1569 | if (m_bypassPermissions) |
1570 | return m_bypassPermissionsValue; | ||
1563 | 1571 | ||
1564 | // m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name); | 1572 | // m_log.DebugFormat("[PERMISSIONS MODULE]: Checking rez object at {0} in {1}", objectPosition, m_scene.Name); |
1565 | 1573 | ||
1566 | ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); | 1574 | ILandObject parcel = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
1567 | if (parcel == null) | 1575 | if (parcel == null || parcel.LandData == null) |
1568 | return false; | 1576 | return false; |
1569 | 1577 | ||
1570 | if ((parcel.LandData.Flags & (uint)ParcelFlags.CreateObjects) != 0) | 1578 | LandData landdata = parcel.LandData; |
1571 | { | 1579 | if ((owner == landdata.OwnerID)) |
1572 | return true; | ||
1573 | } | ||
1574 | else if ((owner == parcel.LandData.OwnerID) || IsAdministrator(owner)) | ||
1575 | { | ||
1576 | return true; | 1580 | return true; |
1577 | } | 1581 | |
1578 | else if (((parcel.LandData.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0) | 1582 | if ((landdata.Flags & (uint)ParcelFlags.CreateObjects) != 0) |
1579 | && (parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, owner, 0)) | ||
1580 | { | ||
1581 | return true; | 1583 | return true; |
1582 | } | 1584 | |
1583 | else if (parcel.LandData.GroupID != UUID.Zero && IsGroupMember(parcel.LandData.GroupID, owner, (ulong)GroupPowers.AllowRez)) | 1585 | if(IsAdministrator(owner)) |
1584 | { | ||
1585 | return true; | 1586 | return true; |
1586 | } | 1587 | |
1587 | else | 1588 | if(landdata.GroupID != UUID.Zero) |
1588 | { | 1589 | { |
1589 | return false; | 1590 | if ((landdata.Flags & (uint)ParcelFlags.CreateGroupObjects) != 0) |
1591 | return IsGroupMember(landdata.GroupID, owner, 0); | ||
1592 | |||
1593 | if (landdata.IsGroupOwned && IsGroupMember(landdata.GroupID, owner, (ulong)GroupPowers.AllowRez)) | ||
1594 | return true; | ||
1590 | } | 1595 | } |
1596 | |||
1597 | return false; | ||
1591 | } | 1598 | } |
1592 | 1599 | ||
1593 | private bool CanRunConsoleCommand(UUID user, Scene requestFromScene) | 1600 | private bool CanRunConsoleCommand(UUID user, Scene requestFromScene) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2d62b50..e611897 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -183,8 +183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
183 | part.SendFullUpdate(remoteClient); | 183 | part.SendFullUpdate(remoteClient); |
184 | 184 | ||
185 | // A prim is only tainted if it's allowed to be edited by the person clicking it. | 185 | // A prim is only tainted if it's allowed to be edited by the person clicking it. |
186 | if (Permissions.CanEditObject(sog.UUID, remoteClient.AgentId) | 186 | if (Permissions.CanChangeSelectedState(sog.UUID, (ScenePresence)remoteClient.SceneAgent)) |
187 | || Permissions.CanMoveObject(sog.UUID, remoteClient.AgentId)) | ||
188 | { | 187 | { |
189 | part.IsSelected = true; | 188 | part.IsSelected = true; |
190 | EventManager.TriggerParcelPrimCountTainted(); | 189 | EventManager.TriggerParcelPrimCountTainted(); |
@@ -250,8 +249,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
250 | // handled by group, but by prim. Legacy cruft. | 249 | // handled by group, but by prim. Legacy cruft. |
251 | // TODO: Make selection flagging per prim! | 250 | // TODO: Make selection flagging per prim! |
252 | // | 251 | // |
253 | if (Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId) | 252 | if (Permissions.CanChangeSelectedState(part.ParentGroup.UUID, (ScenePresence)remoteClient.SceneAgent)) |
254 | || Permissions.CanMoveObject(part.ParentGroup.UUID, remoteClient.AgentId)) | ||
255 | { | 253 | { |
256 | part.IsSelected = false; | 254 | part.IsSelected = false; |
257 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) | 255 | if (!part.ParentGroup.IsAttachment && oldgprSelect != part.ParentGroup.IsSelected) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e045c43..8f32b03 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -404,6 +404,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
404 | 404 | ||
405 | #endregion | 405 | #endregion |
406 | 406 | ||
407 | #region persence EDIT or MOVE OBJECT | ||
408 | private const uint CANSELECTMASK = (uint)( | ||
409 | PrimFlags.ObjectMove | | ||
410 | PrimFlags.ObjectModify | | ||
411 | PrimFlags.ObjectOwnerModify | ||
412 | ); | ||
413 | |||
414 | public bool CanChangeSelectedState(UUID objectID, ScenePresence sp) | ||
415 | { | ||
416 | uint perms = GenerateClientFlags(sp , objectID); | ||
417 | return (perms & CANSELECTMASK) != 0; | ||
418 | } | ||
419 | |||
420 | #endregion | ||
407 | #region EDIT OBJECT | 421 | #region EDIT OBJECT |
408 | public bool CanEditObject(UUID objectID, UUID editorID) | 422 | public bool CanEditObject(UUID objectID, UUID editorID) |
409 | { | 423 | { |