diff options
author | UbitUmarov | 2017-01-17 23:22:02 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-17 23:22:02 +0000 |
commit | 6d784f63060940bd82a2be776385abd40901f57c (patch) | |
tree | c4d98d5348737d6282408b8d88fc9c66ea082ca0 /OpenSim/Region/CoreModules | |
parent | Permissions module: add GetObjectPermissions() that should replace GenericObj... (diff) | |
download | opensim-SC_OLD-6d784f63060940bd82a2be776385abd40901f57c.zip opensim-SC_OLD-6d784f63060940bd82a2be776385abd40901f57c.tar.gz opensim-SC_OLD-6d784f63060940bd82a2be776385abd40901f57c.tar.bz2 opensim-SC_OLD-6d784f63060940bd82a2be776385abd40901f57c.tar.xz |
Permissions module: GenerateClientFlags() no need to keep looking for the same part several times; fix locked mask in GetObjectPermissions()
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 57288dc..6f16ae6 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -693,17 +693,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
693 | PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object | 693 | PrimFlags.ObjectOwnerModify // Tells client that you're the owner of the object |
694 | ); | 694 | ); |
695 | 695 | ||
696 | public uint GenerateClientFlags(ScenePresence sp, uint curEffectivePerms, UUID objID) | 696 | public uint GenerateClientFlags(SceneObjectPart task, ScenePresence sp, uint curEffectivePerms) |
697 | { | 697 | { |
698 | if(sp == null || curEffectivePerms == 0) | 698 | if(sp == null || task == null || curEffectivePerms == 0) |
699 | return (uint)0; | 699 | return 0; |
700 | |||
701 | SceneObjectPart task = m_scene.GetSceneObjectPart(objID); | ||
702 | 700 | ||
703 | // this shouldn't ever happen.. return no permissions/objectflags. | ||
704 | if (task == null) | ||
705 | return (uint)0; | ||
706 | |||
707 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate | 701 | // Remove any of the objectFlags that are temporary. These will get added back if appropriate |
708 | uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ; | 702 | uint objflags = curEffectivePerms & NOT_DEFAULT_FLAGS ; |
709 | 703 | ||
@@ -719,6 +713,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
719 | } | 713 | } |
720 | 714 | ||
721 | SceneObjectGroup grp = task.ParentGroup; | 715 | SceneObjectGroup grp = task.ParentGroup; |
716 | if(grp == null) | ||
717 | return 0; | ||
718 | |||
722 | bool unlocked = (grp.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0; | 719 | bool unlocked = (grp.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0; |
723 | 720 | ||
724 | //bypass option == owner rights | 721 | //bypass option == owner rights |
@@ -887,7 +884,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
887 | if (part == null) | 884 | if (part == null) |
888 | return 0; | 885 | return 0; |
889 | 886 | ||
890 | // Admin should be able to edit anything in the sim (including admin objects) | ||
891 | if (IsAdministrator(currentUser)) | 887 | if (IsAdministrator(currentUser)) |
892 | return (uint)PermissionMask.AllEffective; | 888 | return (uint)PermissionMask.AllEffective; |
893 | 889 | ||
@@ -901,15 +897,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
901 | 897 | ||
902 | uint lockmask = (uint)PermissionMask.AllEffective; | 898 | uint lockmask = (uint)PermissionMask.AllEffective; |
903 | if(locked) | 899 | if(locked) |
904 | lockmask = (uint)PermissionMask.Move; | 900 | lockmask &= ~(uint)PermissionMask.Modify; |
905 | 901 | ||
906 | if (currentUser == objectOwner) | 902 | if (currentUser == objectOwner) |
907 | return group.EffectiveOwnerPerms & lockmask; | 903 | return group.EffectiveOwnerPerms & lockmask; |
908 | 904 | ||
909 | if (group.IsAttachment) | 905 | if (group.IsAttachment) |
910 | return 0; | 906 | return 0; |
911 | 907 | ||
912 | // Friends with benefits should be able to edit the objects too | ||
913 | if (IsFriendWithPerms(currentUser, objectOwner)) | 908 | if (IsFriendWithPerms(currentUser, objectOwner)) |
914 | return group.EffectiveOwnerPerms & lockmask; | 909 | return group.EffectiveOwnerPerms & lockmask; |
915 | 910 | ||