aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs68
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs4
2 files changed, 62 insertions, 10 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
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index c4cb6c7..e045c43 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;
37namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 #region Delegates 39 #region Delegates
40 public delegate uint GenerateClientFlagsHandler(ScenePresence sp, UUID objectID); 40 public delegate uint GenerateClientFlagsHandler(ScenePresence sp, uint curEffectivePerms, 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();
@@ -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(sp, objectID); 198 perms &= check(sp, perms, objectID);
199 } 199 }
200 } 200 }
201 return perms; 201 return perms;