diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 111 |
1 files changed, 51 insertions, 60 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 75d90f3..1bb5181 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -605,19 +605,28 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
605 | } | 605 | } |
606 | 606 | ||
607 | #region Object Permissions | 607 | #region Object Permissions |
608 | #pragma warning disable 0612 | ||
609 | const uint NOT_DEFAULT_FLAGS = (uint)~( | ||
610 | PrimFlags.ObjectCopy | // Tells client you can copy the object | ||
611 | PrimFlags.ObjectModify | // tells client you can modify the object | ||
612 | PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod) | ||
613 | PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it | ||
614 | PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object | ||
615 | PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object | ||
616 | PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object | ||
617 | ); | ||
618 | #pragma warning restore 0612 | ||
619 | |||
620 | const uint EXTRAOWNERMASK = (uint)( | ||
621 | PrimFlags.ObjectYouOwner | | ||
622 | PrimFlags.ObjectAnyOwner | | ||
623 | PrimFlags.ObjectOwnerModify | ||
624 | ); | ||
608 | 625 | ||
609 | public uint GenerateClientFlags(UUID user, UUID objID) | 626 | public uint GenerateClientFlags(UUID user, UUID objID) |
610 | { | 627 | { |
611 | // Here's the way this works, | ||
612 | // ObjectFlags and Permission flags are two different enumerations | 628 | // ObjectFlags and Permission flags are two different enumerations |
613 | // ObjectFlags, however, tells the client to change what it will allow the user to do. | 629 | // ObjectFlags, tells the client what it will allow the user to do. |
614 | // So, that means that all of the permissions type ObjectFlags are /temporary/ and only | ||
615 | // supposed to be set when customizing the objectflags for the client. | ||
616 | |||
617 | // These temporary objectflags get computed and added in this function based on the | ||
618 | // Permission mask that's appropriate! | ||
619 | // Outside of this method, they should never be added to objectflags! | ||
620 | // -teravus | ||
621 | 630 | ||
622 | SceneObjectPart task = m_scene.GetSceneObjectPart(objID); | 631 | SceneObjectPart task = m_scene.GetSceneObjectPart(objID); |
623 | 632 | ||
@@ -626,52 +635,46 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
626 | return (uint)0; | 635 | return (uint)0; |
627 | 636 | ||
628 | uint objflags = task.GetEffectiveObjectFlags(); | 637 | uint objflags = task.GetEffectiveObjectFlags(); |
629 | UUID objectOwner = task.OwnerID; | 638 | |
630 | |||
631 | |||
632 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate | 639 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate |
633 | // in the next bit of code | 640 | // in the next bit of code |
634 | 641 | ||
635 | // libomv will moan about PrimFlags.ObjectYouOfficer being | 642 | objflags &= NOT_DEFAULT_FLAGS; |
636 | // deprecated | ||
637 | #pragma warning disable 0612 | ||
638 | objflags &= (uint) | ||
639 | ~(PrimFlags.ObjectCopy | // Tells client you can copy the object | ||
640 | PrimFlags.ObjectModify | // tells client you can modify the object | ||
641 | PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod) | ||
642 | PrimFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it | ||
643 | PrimFlags.ObjectYouOwner | // Tells client that you're the owner of the object | ||
644 | PrimFlags.ObjectAnyOwner | // Tells client that someone owns the object | ||
645 | PrimFlags.ObjectOwnerModify | // Tells client that you're the owner of the object | ||
646 | PrimFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set | ||
647 | ); | ||
648 | #pragma warning restore 0612 | ||
649 | |||
650 | // Creating the three ObjectFlags options for this method to choose from. | ||
651 | // Customize the OwnerMask | ||
652 | uint objectOwnerMask = ApplyObjectModifyMasks(task.OwnerMask, objflags); | ||
653 | objectOwnerMask |= (uint)PrimFlags.ObjectYouOwner | (uint)PrimFlags.ObjectAnyOwner | (uint)PrimFlags.ObjectOwnerModify; | ||
654 | |||
655 | // Customize the GroupMask | ||
656 | uint objectGroupMask = ApplyObjectModifyMasks(task.GroupMask, objflags); | ||
657 | |||
658 | // Customize the EveryoneMask | ||
659 | uint objectEveryoneMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | ||
660 | if (objectOwner != UUID.Zero) | ||
661 | objectEveryoneMask |= (uint)PrimFlags.ObjectAnyOwner; | ||
662 | 643 | ||
644 | // get a relevant class for current user on task | ||
663 | PermissionClass permissionClass = GetPermissionClass(user, task); | 645 | PermissionClass permissionClass = GetPermissionClass(user, task); |
664 | 646 | ||
647 | // handle acording | ||
648 | uint returnMask = 0; | ||
665 | switch (permissionClass) | 649 | switch (permissionClass) |
666 | { | 650 | { |
667 | case PermissionClass.Owner: | 651 | case PermissionClass.Owner: |
668 | return objectOwnerMask; | 652 | // Customize the OwnerMask |
653 | // on next line EveryoneMask possible is redundant | ||
654 | // but then it should also be on GroupMask | ||
655 | returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags); | ||
656 | returnMask |= EXTRAOWNERMASK; | ||
657 | break; | ||
658 | |||
669 | case PermissionClass.Group: | 659 | case PermissionClass.Group: |
670 | return objectGroupMask | objectEveryoneMask; | 660 | // Customize the GroupMask |
661 | returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags); | ||
662 | if (task.OwnerID != UUID.Zero) | ||
663 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | ||
664 | break; | ||
665 | |||
671 | case PermissionClass.Everyone: | 666 | case PermissionClass.Everyone: |
672 | default: | 667 | default: |
673 | return objectEveryoneMask; | 668 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); |
669 | if (task.OwnerID != UUID.Zero) | ||
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; | ||
674 | } | 676 | } |
677 | return returnMask; | ||
675 | } | 678 | } |
676 | 679 | ||
677 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) | 680 | private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) |
@@ -715,31 +718,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
715 | if (user == objectOwner) | 718 | if (user == objectOwner) |
716 | return PermissionClass.Owner; | 719 | return PermissionClass.Owner; |
717 | 720 | ||
718 | if (IsFriendWithPerms(user, objectOwner) && !obj.ParentGroup.IsAttachment) | ||
719 | return PermissionClass.Owner; | ||
720 | |||
721 | // Estate users should be able to edit anything in the sim if RegionOwnerIsGod is set | ||
722 | if (m_RegionOwnerIsGod && IsEstateManager(user) && !IsAdministrator(objectOwner)) | ||
723 | return PermissionClass.Owner; | ||
724 | |||
725 | // Admin should be able to edit anything in the sim (including admin objects) | 721 | // Admin should be able to edit anything in the sim (including admin objects) |
726 | if (IsAdministrator(user)) | 722 | if (IsAdministrator(user)) |
727 | return PermissionClass.Owner; | 723 | return PermissionClass.Owner; |
728 | 724 | ||
729 | /* to review later | 725 | if(!obj.ParentGroup.IsAttachment) |
730 | // Users should be able to edit what is over their land. | ||
731 | Vector3 taskPos = obj.AbsolutePosition; | ||
732 | ILandObject parcel = m_scene.LandChannel.GetLandObject(taskPos.X, taskPos.Y); | ||
733 | if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod) | ||
734 | { | 726 | { |
735 | // Admin objects should not be editable by the above | 727 | if (IsFriendWithPerms(user, objectOwner) ) |
736 | if (!IsAdministrator(objectOwner)) | ||
737 | return PermissionClass.Owner; | 728 | return PermissionClass.Owner; |
729 | |||
730 | // Group permissions | ||
731 | if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0)) | ||
732 | return PermissionClass.Group; | ||
738 | } | 733 | } |
739 | */ | ||
740 | // Group permissions | ||
741 | if ((obj.GroupID != UUID.Zero) && IsGroupMember(obj.GroupID, user, 0)) | ||
742 | return PermissionClass.Group; | ||
743 | 734 | ||
744 | return PermissionClass.Everyone; | 735 | return PermissionClass.Everyone; |
745 | } | 736 | } |