diff options
author | UbitUmarov | 2017-01-11 17:10:29 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-11 17:10:29 +0000 |
commit | 1253f193251d65da24ea081cbe207c9cbd1318ac (patch) | |
tree | 88f1bf66615e1a25c562a22e6290c605b4863b0c /OpenSim/Region/CoreModules/World | |
parent | change GenerateClientFlags(...) to work with a scenepresence; make use of the... (diff) | |
download | opensim-SC-1253f193251d65da24ea081cbe207c9cbd1318ac.zip opensim-SC-1253f193251d65da24ea081cbe207c9cbd1318ac.tar.gz opensim-SC-1253f193251d65da24ea081cbe207c9cbd1318ac.tar.bz2 opensim-SC-1253f193251d65da24ea081cbe207c9cbd1318ac.tar.xz |
more changes to GenerateClientFlags(), use already cached presence group information, let it be aware of groups roles. (not exactly as the other grid)
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 495da8b..8fcf44f 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -480,6 +480,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
480 | return false; | 480 | return false; |
481 | } | 481 | } |
482 | 482 | ||
483 | private bool CheckGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask) | ||
484 | { | ||
485 | if(sp == null || sp.ControllingClient == null) | ||
486 | return false; | ||
487 | |||
488 | ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID); | ||
489 | |||
490 | return (grpPowers & powersMask) != 0; | ||
491 | } | ||
492 | |||
493 | private bool CheckActiveGroupPowers(ScenePresence sp, UUID groupID, ulong powersMask) | ||
494 | { | ||
495 | if(sp == null || sp.ControllingClient == null) | ||
496 | return false; | ||
497 | |||
498 | if(sp.ControllingClient.ActiveGroupId != groupID) | ||
499 | return false; | ||
500 | // activeGroupPowers only get current selected role powers, at least with xmlgroups. | ||
501 | // lets get any role avoiding the extra burden of user also having to change role | ||
502 | // ulong grpPowers = sp.ControllingClient.ActiveGroupPowers(groupID); | ||
503 | ulong grpPowers = sp.ControllingClient.GetGroupPowers(groupID); | ||
504 | |||
505 | return (grpPowers & powersMask) != 0; | ||
506 | } | ||
507 | |||
483 | /// <summary> | 508 | /// <summary> |
484 | /// Parse a user set configuration setting | 509 | /// Parse a user set configuration setting |
485 | /// </summary> | 510 | /// </summary> |
@@ -623,7 +648,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
623 | PrimFlags.ObjectOwnerModify | 648 | PrimFlags.ObjectOwnerModify |
624 | ); | 649 | ); |
625 | 650 | ||
626 | public uint GenerateClientFlags(ScenePresence sp, UUID objID) | 651 | public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID) |
627 | { | 652 | { |
628 | // ObjectFlags and Permission flags are two different enumerations | 653 | // ObjectFlags and Permission flags are two different enumerations |
629 | // ObjectFlags, tells the client what it will allow the user to do. | 654 | // ObjectFlags, tells the client what it will allow the user to do. |
@@ -634,12 +659,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
634 | if (task == null) | 659 | if (task == null) |
635 | return (uint)0; | 660 | return (uint)0; |
636 | 661 | ||
637 | uint objflags = task.GetEffectiveObjectFlags(); | 662 | if(curEffectivePerms == 0) |
663 | return 0; | ||
638 | 664 | ||
639 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate | 665 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate |
640 | // in the next bit of code | 666 | // in the next bit of code |
641 | 667 | uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ; | |
642 | objflags &= NOT_DEFAULT_FLAGS; | ||
643 | 668 | ||
644 | // get a relevant class for current presence on task | 669 | // get a relevant class for current presence on task |
645 | PermissionClass permissionClass = GetPermissionClass(sp, task); | 670 | PermissionClass permissionClass = GetPermissionClass(sp, task); |
@@ -658,9 +683,35 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
658 | 683 | ||
659 | case PermissionClass.Group: | 684 | case PermissionClass.Group: |
660 | // Customize the GroupMask | 685 | // Customize the GroupMask |
661 | returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags); | 686 | if(task.GroupID == task.OwnerID) |
662 | if (task.OwnerID != UUID.Zero) | 687 | { |
663 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | 688 | // object is owned by group, owner rights do apply |
689 | // we are not limiting to group owned parcel so this work anywhere | ||
690 | if(CheckGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate)) | ||
691 | // instead forcing active group can be safeguard againts casual mistakes ?? | ||
692 | //if(CheckActiveGroupPowers(sp, task.GroupID, (ulong)GroupPowers.ObjectManipulate)) | ||
693 | { | ||
694 | returnMask = ApplyObjectModifyMasks(task.OwnerMask | task.EveryoneMask, objflags); | ||
695 | returnMask |= | ||
696 | (uint)PrimFlags.ObjectGroupOwned | | ||
697 | (uint)PrimFlags.ObjectAnyOwner; | ||
698 | if((returnMask & (uint)PrimFlags.ObjectModify) != 0) | ||
699 | returnMask |= (uint)PrimFlags.ObjectOwnerModify; | ||
700 | } | ||
701 | else | ||
702 | { | ||
703 | // no special rights | ||
704 | returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags); | ||
705 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | ||
706 | } | ||
707 | } | ||
708 | else | ||
709 | { | ||
710 | // not group owned, group sharing rights apply | ||
711 | returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags); | ||
712 | if (task.OwnerID != UUID.Zero) | ||
713 | returnMask |= (uint)PrimFlags.ObjectAnyOwner; | ||
714 | } | ||
664 | break; | 715 | break; |
665 | 716 | ||
666 | case PermissionClass.Everyone: | 717 | case PermissionClass.Everyone: |
@@ -726,7 +777,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
726 | return PermissionClass.Owner; | 777 | return PermissionClass.Owner; |
727 | 778 | ||
728 | // Group permissions | 779 | // Group permissions |
729 | if (obj.GroupID != UUID.Zero && IsGroupMember(obj.GroupID, user, 0)) | 780 | // in future group membership must leave llclentViewer, but for now it is there. |
781 | if (obj.GroupID != UUID.Zero && sp.ControllingClient != null && sp.ControllingClient.IsGroupMember(obj.GroupID)) | ||
730 | return PermissionClass.Group; | 782 | return PermissionClass.Group; |
731 | } | 783 | } |
732 | 784 | ||