diff options
author | UbitUmarov | 2017-01-19 19:01:56 +0000 |
---|---|---|
committer | UbitUmarov | 2017-01-19 19:01:56 +0000 |
commit | 69bcbd856b8785b2912fa4ceac7411967756107c (patch) | |
tree | 81c322e6ea426580044ede6b05934fb660fdcf38 /OpenSim | |
parent | actually make use of it as viewers requested (diff) | |
download | opensim-SC_OLD-69bcbd856b8785b2912fa4ceac7411967756107c.zip opensim-SC_OLD-69bcbd856b8785b2912fa4ceac7411967756107c.tar.gz opensim-SC_OLD-69bcbd856b8785b2912fa4ceac7411967756107c.tar.bz2 opensim-SC_OLD-69bcbd856b8785b2912fa4ceac7411967756107c.tar.xz |
change CanDuplicateObject
Diffstat (limited to 'OpenSim')
4 files changed, 19 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index b4c5072..341bd7e 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -1221,24 +1221,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1221 | return IsAdministrator(user); | 1221 | return IsAdministrator(user); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID userID, Scene scene, Vector3 objectPosition) | 1224 | private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene) |
1225 | { | 1225 | { |
1226 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1226 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1227 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1227 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1228 | 1228 | ||
1229 | SceneObjectGroup sog = scene.GetGroupByPrim(objectID); | 1229 | if (sog == null || sog.IsDeleted || sp == null || sp.IsDeleted) |
1230 | if (sog == null) | ||
1231 | return false; | 1230 | return false; |
1232 | 1231 | ||
1233 | uint perms = GetObjectPermissions(userID, sog, false); | 1232 | uint perms = GetObjectPermissions(sp, sog, false); |
1234 | if((perms & (uint)PermissionMask.Copy) == 0) | 1233 | if((perms & (uint)PermissionMask.Copy) == 0) |
1235 | return false; | 1234 | return false; |
1236 | 1235 | ||
1237 | if(sog.OwnerID != userID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0) | 1236 | if(sog.OwnerID != sp.UUID && sog.OwnerID != sog.GroupID && (perms & (uint)PermissionMask.Transfer) == 0) |
1238 | return false; | 1237 | return false; |
1239 | 1238 | ||
1240 | //If they can rez, they can duplicate | 1239 | //If they can rez, they can duplicate |
1241 | return CanRezObject(objectCount, userID, objectPosition, scene); | 1240 | return CanRezObject(0, sp.UUID, sog.AbsolutePosition, scene); |
1242 | } | 1241 | } |
1243 | 1242 | ||
1244 | private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene) | 1243 | private bool CanDeleteObject(UUID objectID, UUID userID, Scene scene) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index a7f3dd7..3e75c8a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
47 | public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 47 | public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
48 | public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); | 48 | public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); |
49 | public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 49 | public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
50 | public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); | 50 | public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp, Scene scenen); |
51 | public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene); | 51 | public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID, Scene scene); |
52 | public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); | 52 | public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp); |
53 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); | 53 | public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); |
@@ -392,15 +392,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
392 | #endregion | 392 | #endregion |
393 | 393 | ||
394 | #region DUPLICATE OBJECT | 394 | #region DUPLICATE OBJECT |
395 | public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) | 395 | public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID) |
396 | { | 396 | { |
397 | DuplicateObjectHandler handler = OnDuplicateObject; | 397 | DuplicateObjectHandler handler = OnDuplicateObject; |
398 | if (handler != null) | 398 | if (handler != null) |
399 | { | 399 | { |
400 | if(sog == null || sog.IsDeleted) | ||
401 | return false; | ||
402 | ScenePresence sp = m_scene.GetScenePresence(agentID); | ||
403 | if(sp == null || sp.IsDeleted) | ||
404 | return false; | ||
400 | Delegate[] list = handler.GetInvocationList(); | 405 | Delegate[] list = handler.GetInvocationList(); |
401 | foreach (DuplicateObjectHandler h in list) | 406 | foreach (DuplicateObjectHandler h in list) |
402 | { | 407 | { |
403 | if (h(objectCount, objectID, owner, m_scene, objectPosition) == false) | 408 | if (h(sog, sp, m_scene) == false) |
404 | return false; | 409 | return false; |
405 | } | 410 | } |
406 | } | 411 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc13692..9264138 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -2066,8 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2066 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 2066 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
2067 | if (original != null) | 2067 | if (original != null) |
2068 | { | 2068 | { |
2069 | if (m_parentScene.Permissions.CanDuplicateObject( | 2069 | if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID)) |
2070 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | ||
2071 | { | 2070 | { |
2072 | SceneObjectGroup copy = original.Copy(true); | 2071 | SceneObjectGroup copy = original.Copy(true); |
2073 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 2072 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
diff --git a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs index 9c0fa75..4875a61 100644 --- a/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs +++ b/OpenSim/Region/OptionalModules/PrimLimitsModule/PrimLimitsModule.cs | |||
@@ -106,6 +106,7 @@ namespace OpenSim.Region.OptionalModules | |||
106 | 106 | ||
107 | private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene) | 107 | private bool CanRezObject(int objectCount, UUID ownerID, Vector3 objectPosition, Scene scene) |
108 | { | 108 | { |
109 | |||
109 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); | 110 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
110 | 111 | ||
111 | string response = DoCommonChecks(objectCount, ownerID, lo, scene); | 112 | string response = DoCommonChecks(objectCount, ownerID, lo, scene); |
@@ -119,15 +120,16 @@ namespace OpenSim.Region.OptionalModules | |||
119 | } | 120 | } |
120 | 121 | ||
121 | //OnDuplicateObject | 122 | //OnDuplicateObject |
122 | private bool CanDuplicateObject(int objectCount, UUID objectID, UUID ownerID, Scene scene, Vector3 objectPosition) | 123 | private bool CanDuplicateObject(SceneObjectGroup sog, ScenePresence sp, Scene scene) |
123 | { | 124 | { |
125 | Vector3 objectPosition = sog.AbsolutePosition; | ||
124 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); | 126 | ILandObject lo = scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); |
125 | 127 | ||
126 | string response = DoCommonChecks(objectCount, ownerID, lo, scene); | 128 | string response = DoCommonChecks(sog.PrimCount, sp.UUID, lo, scene); |
127 | 129 | ||
128 | if (response != null) | 130 | if (response != null) |
129 | { | 131 | { |
130 | m_dialogModule.SendAlertToUser(ownerID, response); | 132 | m_dialogModule.SendAlertToUser(sp.UUID, response); |
131 | return false; | 133 | return false; |
132 | } | 134 | } |
133 | return true; | 135 | return true; |