aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-01-12 16:58:59 +0000
committerUbitUmarov2017-01-12 16:58:59 +0000
commit3e0a61915fef715c0c89ab5ec233dc217c335429 (patch)
tree8505806d0241395def31ee7f2a2846eb14e8d6ad
parentMerge branch 'master' of opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-3e0a61915fef715c0c89ab5ec233dc217c335429.zip
opensim-SC-3e0a61915fef715c0c89ab5ec233dc217c335429.tar.gz
opensim-SC-3e0a61915fef715c0c89ab5ec233dc217c335429.tar.bz2
opensim-SC-3e0a61915fef715c0c89ab5ec233dc217c335429.tar.xz
GenerateClientFlags: consider locked state, change object group; CanRezObject: remove odd elses and group roles are only for group owned land
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs97
1 files changed, 52 insertions, 45 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)