diff options
Add permissions hooks for object transfers
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Permissions.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 66439ab..e1fedf4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -43,6 +43,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
43 | public delegate bool PropagatePermissionsHandler(); | 43 | public delegate bool PropagatePermissionsHandler(); |
44 | public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); | 44 | public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); |
45 | public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); | 45 | public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); |
46 | public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); | ||
46 | public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); | 47 | public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); |
47 | public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); | 48 | public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); |
48 | public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); | 49 | public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); |
@@ -80,10 +81,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); | 81 | public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); |
81 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 82 | public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
82 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | 83 | public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); |
84 | public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); | ||
83 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); | 85 | public delegate bool CreateUserInventoryHandler(int invType, UUID userID); |
84 | public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID); | 86 | public delegate bool EditUserInventoryHandler(UUID itemID, UUID userID); |
85 | public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); | 87 | public delegate bool CopyUserInventoryHandler(UUID itemID, UUID userID); |
86 | public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); | 88 | public delegate bool DeleteUserInventoryHandler(UUID itemID, UUID userID); |
89 | public delegate bool TransferUserInventoryHandler(UUID itemID, UUID userID, UUID recipientID); | ||
87 | public delegate bool TeleportHandler(UUID userID, Scene scene); | 90 | public delegate bool TeleportHandler(UUID userID, Scene scene); |
88 | public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); | 91 | public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); |
89 | public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); | 92 | public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); |
@@ -107,6 +110,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
107 | public event PropagatePermissionsHandler OnPropagatePermissions; | 110 | public event PropagatePermissionsHandler OnPropagatePermissions; |
108 | public event RezObjectHandler OnRezObject; | 111 | public event RezObjectHandler OnRezObject; |
109 | public event DeleteObjectHandler OnDeleteObject; | 112 | public event DeleteObjectHandler OnDeleteObject; |
113 | public event TransferObjectHandler OnTransferObject; | ||
110 | public event TakeObjectHandler OnTakeObject; | 114 | public event TakeObjectHandler OnTakeObject; |
111 | public event TakeCopyObjectHandler OnTakeCopyObject; | 115 | public event TakeCopyObjectHandler OnTakeCopyObject; |
112 | public event DuplicateObjectHandler OnDuplicateObject; | 116 | public event DuplicateObjectHandler OnDuplicateObject; |
@@ -144,10 +148,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | public event CreateObjectInventoryHandler OnCreateObjectInventory; | 148 | public event CreateObjectInventoryHandler OnCreateObjectInventory; |
145 | public event CopyObjectInventoryHandler OnCopyObjectInventory; | 149 | public event CopyObjectInventoryHandler OnCopyObjectInventory; |
146 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; | 150 | public event DeleteObjectInventoryHandler OnDeleteObjectInventory; |
151 | public event TransferObjectInventoryHandler OnTransferObjectInventory; | ||
147 | public event CreateUserInventoryHandler OnCreateUserInventory; | 152 | public event CreateUserInventoryHandler OnCreateUserInventory; |
148 | public event EditUserInventoryHandler OnEditUserInventory; | 153 | public event EditUserInventoryHandler OnEditUserInventory; |
149 | public event CopyUserInventoryHandler OnCopyUserInventory; | 154 | public event CopyUserInventoryHandler OnCopyUserInventory; |
150 | public event DeleteUserInventoryHandler OnDeleteUserInventory; | 155 | public event DeleteUserInventoryHandler OnDeleteUserInventory; |
156 | public event TransferUserInventoryHandler OnTransferUserInventory; | ||
151 | public event TeleportHandler OnTeleport; | 157 | public event TeleportHandler OnTeleport; |
152 | public event ControlPrimMediaHandler OnControlPrimMedia; | 158 | public event ControlPrimMediaHandler OnControlPrimMedia; |
153 | public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; | 159 | public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; |
@@ -264,10 +270,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | } | 270 | } |
265 | } | 271 | } |
266 | 272 | ||
267 | // m_log.DebugFormat( | 273 | return result; |
268 | // "[SCENE PERMISSIONS]: CanDeleteObject() fired for object {0}, deleter {1}, result {2}", | 274 | } |
269 | // objectID, deleter, result); | 275 | |
270 | 276 | public bool CanTransferObject(UUID objectID, UUID recipient) | |
277 | { | ||
278 | bool result = true; | ||
279 | |||
280 | TransferObjectHandler handler = OnTransferObject; | ||
281 | if (handler != null) | ||
282 | { | ||
283 | Delegate[] list = handler.GetInvocationList(); | ||
284 | foreach (TransferObjectHandler h in list) | ||
285 | { | ||
286 | if (h(objectID, recipient, m_scene) == false) | ||
287 | { | ||
288 | result = false; | ||
289 | break; | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
271 | return result; | 294 | return result; |
272 | } | 295 | } |
273 | 296 | ||
@@ -917,6 +940,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
917 | return true; | 940 | return true; |
918 | } | 941 | } |
919 | 942 | ||
943 | public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID) | ||
944 | { | ||
945 | TransferObjectInventoryHandler handler = OnTransferObjectInventory; | ||
946 | if (handler != null) | ||
947 | { | ||
948 | Delegate[] list = handler.GetInvocationList(); | ||
949 | foreach (TransferObjectInventoryHandler h in list) | ||
950 | { | ||
951 | if (h(itemID, objectID, userID) == false) | ||
952 | return false; | ||
953 | } | ||
954 | } | ||
955 | return true; | ||
956 | } | ||
957 | |||
920 | /// <summary> | 958 | /// <summary> |
921 | /// Check whether the specified user is allowed to create the given inventory type in their inventory. | 959 | /// Check whether the specified user is allowed to create the given inventory type in their inventory. |
922 | /// </summary> | 960 | /// </summary> |
@@ -1001,6 +1039,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1001 | return true; | 1039 | return true; |
1002 | } | 1040 | } |
1003 | 1041 | ||
1042 | public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID) | ||
1043 | { | ||
1044 | TransferUserInventoryHandler handler = OnTransferUserInventory; | ||
1045 | if (handler != null) | ||
1046 | { | ||
1047 | Delegate[] list = handler.GetInvocationList(); | ||
1048 | foreach (TransferUserInventoryHandler h in list) | ||
1049 | { | ||
1050 | if (h(itemID, userID, recipientID) == false) | ||
1051 | return false; | ||
1052 | } | ||
1053 | } | ||
1054 | return true; | ||
1055 | } | ||
1056 | |||
1004 | public bool CanTeleport(UUID userID) | 1057 | public bool CanTeleport(UUID userID) |
1005 | { | 1058 | { |
1006 | TeleportHandler handler = OnTeleport; | 1059 | TeleportHandler handler = OnTeleport; |