diff options
3 files changed, 41 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 1c8d4b8..b4c5072 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -71,12 +71,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
71 | #region Constants | 71 | #region Constants |
72 | // These are here for testing. They will be taken out | 72 | // These are here for testing. They will be taken out |
73 | 73 | ||
74 | //private uint PERM_ALL = (uint)2147483647; | ||
75 | private uint PERM_COPY = (uint)32768; | ||
76 | //private uint PERM_MODIFY = (uint)16384; | ||
77 | private uint PERM_MOVE = (uint)524288; | ||
78 | private uint PERM_TRANS = (uint)8192; | ||
79 | // private uint PERM_LOCKED = (uint)540672; | ||
80 | private uint PERM_LOCKED = (uint)524288; // same as move | 74 | private uint PERM_LOCKED = (uint)524288; // same as move |
81 | 75 | ||
82 | /// <value> | 76 | /// <value> |
@@ -867,6 +861,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
867 | return PermissionClass.Everyone; | 861 | return PermissionClass.Everyone; |
868 | } | 862 | } |
869 | 863 | ||
864 | // get effective object permissions using user UUID. User rights will be fixed | ||
870 | protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked) | 865 | protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked) |
871 | { | 866 | { |
872 | if (group == null) | 867 | if (group == null) |
@@ -918,6 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
918 | return group.EffectiveEveryOnePerms & lockmask; | 913 | return group.EffectiveEveryOnePerms & lockmask; |
919 | } | 914 | } |
920 | 915 | ||
916 | // get effective object permissions using present presence. So some may depend on requested rights (ie God) | ||
921 | protected uint GetObjectPermissions(ScenePresence sp, SceneObjectGroup group, bool denyOnLocked) | 917 | protected uint GetObjectPermissions(ScenePresence sp, SceneObjectGroup group, bool denyOnLocked) |
922 | { | 918 | { |
923 | if (sp == null || sp.IsDeleted || group == null || group.IsDeleted) | 919 | if (sp == null || sp.IsDeleted || group == null || group.IsDeleted) |
@@ -1178,15 +1174,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1178 | return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false); | 1174 | return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false); |
1179 | } | 1175 | } |
1180 | 1176 | ||
1181 | private bool CanDeedObject(UUID user, UUID group, Scene scene) | 1177 | private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID) |
1182 | { | 1178 | { |
1183 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1179 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1184 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1180 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1185 | 1181 | ||
1186 | ScenePresence sp = scene.GetScenePresence(user); | 1182 | if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted || targetGroupID == UUID.Zero) |
1187 | IClientAPI client = sp.ControllingClient; | 1183 | return false; |
1184 | |||
1185 | // object has group already? | ||
1186 | if(sog.GroupID != targetGroupID) | ||
1187 | return false; | ||
1188 | |||
1189 | // is effectivelly shared? | ||
1190 | if(sog.EffectiveGroupPerms == 0) | ||
1191 | return false; | ||
1192 | |||
1193 | if(sp.IsGod) | ||
1194 | return true; | ||
1195 | |||
1196 | // owned by requester? | ||
1197 | if(sog.OwnerID != sp.UUID) | ||
1198 | return false; | ||
1199 | |||
1200 | // owner can transfer? | ||
1201 | if((sog.EffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0) | ||
1202 | return false; | ||
1203 | |||
1204 | // group member ? | ||
1205 | ulong powers = 0; | ||
1206 | if(!GroupMemberPowers(targetGroupID, sp, ref powers)) | ||
1207 | return false; | ||
1188 | 1208 | ||
1189 | if ((client.GetGroupPowers(group) & (ulong)GroupPowers.DeedObject) == 0) | 1209 | // has group rights? |
1210 | if ((powers & (ulong)GroupPowers.DeedObject) == 0) | ||
1190 | return false; | 1211 | return false; |
1191 | 1212 | ||
1192 | return true; | 1213 | return true; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ad913f7..3230a2b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2717,9 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2717 | { | 2717 | { |
2718 | if (ownerID != UUID.Zero) | 2718 | if (ownerID != UUID.Zero) |
2719 | return; | 2719 | return; |
2720 | |||
2721 | if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID)) | ||
2722 | return; | ||
2723 | } | 2720 | } |
2724 | 2721 | ||
2725 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); | 2722 | List<SceneObjectGroup> groups = new List<SceneObjectGroup>(); |
@@ -2750,15 +2747,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2750 | child.TriggerScriptChangedEvent(Changed.OWNER); | 2747 | child.TriggerScriptChangedEvent(Changed.OWNER); |
2751 | } | 2748 | } |
2752 | } | 2749 | } |
2753 | else // The object was deeded to the group | 2750 | else // The object deeded to the group |
2754 | { | 2751 | { |
2755 | if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId) | 2752 | if (!Permissions.CanDeedObject(remoteClient, sog, groupID)) |
2756 | continue; | ||
2757 | |||
2758 | if (!Permissions.CanTransferObject(sog.UUID, groupID)) | ||
2759 | continue; | ||
2760 | |||
2761 | if (sog.GroupID != groupID) | ||
2762 | continue; | 2753 | continue; |
2763 | 2754 | ||
2764 | sog.SetOwnerId(groupID); | 2755 | sog.SetOwnerId(groupID); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 3491792..a7f3dd7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
78 | public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); | 78 | public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); |
79 | public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); | 79 | public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); |
80 | public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); | 80 | public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); |
81 | public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene); | 81 | public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID); |
82 | public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); | 82 | public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); |
83 | public delegate bool LinkObjectHandler(UUID user, UUID objectID); | 83 | public delegate bool LinkObjectHandler(UUID user, UUID objectID); |
84 | public delegate bool DelinkObjectHandler(UUID user, UUID objectID); | 84 | public delegate bool DelinkObjectHandler(UUID user, UUID objectID); |
@@ -934,15 +934,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
934 | return true; | 934 | return true; |
935 | } | 935 | } |
936 | 936 | ||
937 | public bool CanDeedObject(UUID user, UUID group) | 937 | public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID) |
938 | { | 938 | { |
939 | DeedObjectHandler handler = OnDeedObject; | 939 | DeedObjectHandler handler = OnDeedObject; |
940 | if (handler != null) | 940 | if (handler != null) |
941 | { | 941 | { |
942 | if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero) | ||
943 | return false; | ||
944 | |||
945 | ScenePresence sp = client.SceneAgent as ScenePresence; | ||
946 | |||
942 | Delegate[] list = handler.GetInvocationList(); | 947 | Delegate[] list = handler.GetInvocationList(); |
943 | foreach (DeedObjectHandler h in list) | 948 | foreach (DeedObjectHandler h in list) |
944 | { | 949 | { |
945 | if (h(user, group, m_scene) == false) | 950 | if (h(sp, sog, targetGroupID) == false) |
946 | return false; | 951 | return false; |
947 | } | 952 | } |
948 | } | 953 | } |