aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs525
1 files changed, 383 insertions, 142 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 535d87a..a75671e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -35,52 +35,63 @@ using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36 36
37namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 #region Delegates 39 #region Delegates
40 public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); 40 public delegate uint GenerateClientFlagsHandler(SceneObjectPart part, ScenePresence sp, uint curEffectivePerms);
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();
44 public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene); 44 public delegate bool RezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition);
45 public delegate bool DeleteObjectHandler(UUID objectID, UUID deleter, Scene scene); 45 public delegate bool DeleteObjectHandlerByIDs(UUID objectID, UUID deleter);
46 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient, Scene scene); 46 public delegate bool DeleteObjectHandler(SceneObjectGroup sog, ScenePresence sp);
47 public delegate bool TakeObjectHandler(UUID objectID, UUID stealer, Scene scene); 47 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
48 public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); 48 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
49 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 49 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
50 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 50 public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType);
51 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType);
52 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); 52 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
53 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 53 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
54 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); 54 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
55 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); 55 public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
56 public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); 56 public delegate bool EditObjectPermsHandler(SceneObjectGroup sog, UUID editorID);
57 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 57 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
58 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); 58 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
59 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 59 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
60 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); 60 public delegate bool ObjectEnterWithScriptsHandler(SceneObjectGroup sog, ILandObject land);
61 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 61 public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects);
62 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); 62 public delegate bool InstantMessageHandler(UUID user, UUID target);
63 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); 63 public delegate bool InventoryTransferHandler(UUID user, UUID target);
64 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); 64 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
65 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene); 65 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
66 public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene); 66 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
67 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); 67 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
68 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); 68 public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
69 public delegate bool IsGodHandler(UUID user, Scene requestFromScene); 69 public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
70 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); 70 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
71 public delegate bool StartScriptHandler(UUID script, UUID user);
72 public delegate bool StopScriptHandler(UUID script, UUID user);
73 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
74 public delegate bool TerraformLandHandler(UUID user, Vector3 position);
75 public delegate bool RunConsoleCommandHandler(UUID user);
76 public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
77 public delegate bool IsGodHandler(UUID user);
78 public delegate bool IsGridGodHandler(UUID user);
71 public delegate bool IsAdministratorHandler(UUID user); 79 public delegate bool IsAdministratorHandler(UUID user);
72 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 80 public delegate bool IsEstateManagerHandler(UUID user);
73 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene); 81 public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
74 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 82 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
75 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 83 public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
76 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 84 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
77 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); 85 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
78 public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene); 86 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
79 public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); 87 public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
88 public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
80 public delegate bool LinkObjectHandler(UUID user, UUID objectID); 89 public delegate bool LinkObjectHandler(UUID user, UUID objectID);
81 public delegate bool DelinkObjectHandler(UUID user, UUID objectID); 90 public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
82 public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); 91 public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
83 public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 92 public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
93 public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
94 public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart);
84 public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 95 public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
85 public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 96 public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
86 public delegate bool CreateUserInventoryHandler(int invType, UUID userID); 97 public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
@@ -96,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes
96 public class ScenePermissions 107 public class ScenePermissions
97 { 108 {
98// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 109// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
99 110
100 private Scene m_scene; 111 private Scene m_scene;
101 112
102 public ScenePermissions(Scene scene) 113 public ScenePermissions(Scene scene)
@@ -110,15 +121,24 @@ namespace OpenSim.Region.Framework.Scenes
110 public event BypassPermissionsHandler OnBypassPermissions; 121 public event BypassPermissionsHandler OnBypassPermissions;
111 public event PropagatePermissionsHandler OnPropagatePermissions; 122 public event PropagatePermissionsHandler OnPropagatePermissions;
112 public event RezObjectHandler OnRezObject; 123 public event RezObjectHandler OnRezObject;
124 public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
113 public event DeleteObjectHandler OnDeleteObject; 125 public event DeleteObjectHandler OnDeleteObject;
114 public event TransferObjectHandler OnTransferObject; 126 public event TransferObjectHandler OnTransferObject;
115 public event TakeObjectHandler OnTakeObject; 127 public event TakeObjectHandler OnTakeObject;
128
129 public event SellGroupObjectHandler OnSellGroupObject;
130 public event SellObjectHandlerByUserID OnSellObjectByUserID;
131 public event SellObjectHandler OnSellObject;
132
116 public event TakeCopyObjectHandler OnTakeCopyObject; 133 public event TakeCopyObjectHandler OnTakeCopyObject;
117 public event DuplicateObjectHandler OnDuplicateObject; 134 public event DuplicateObjectHandler OnDuplicateObject;
135 public event EditObjectByIDsHandler OnEditObjectByIDs;
118 public event EditObjectHandler OnEditObject; 136 public event EditObjectHandler OnEditObject;
137 public event EditObjectPermsHandler OnEditObjectPerms;
119 public event EditObjectInventoryHandler OnEditObjectInventory; 138 public event EditObjectInventoryHandler OnEditObjectInventory;
120 public event MoveObjectHandler OnMoveObject; 139 public event MoveObjectHandler OnMoveObject;
121 public event ObjectEntryHandler OnObjectEntry; 140 public event ObjectEntryHandler OnObjectEntry;
141 public event ObjectEnterWithScriptsHandler OnObjectEnterWithScripts;
122 public event ReturnObjectsHandler OnReturnObjects; 142 public event ReturnObjectsHandler OnReturnObjects;
123 public event InstantMessageHandler OnInstantMessage; 143 public event InstantMessageHandler OnInstantMessage;
124 public event InventoryTransferHandler OnInventoryTransfer; 144 public event InventoryTransferHandler OnInventoryTransfer;
@@ -126,6 +146,7 @@ namespace OpenSim.Region.Framework.Scenes
126 public event ViewNotecardHandler OnViewNotecard; 146 public event ViewNotecardHandler OnViewNotecard;
127 public event EditScriptHandler OnEditScript; 147 public event EditScriptHandler OnEditScript;
128 public event EditNotecardHandler OnEditNotecard; 148 public event EditNotecardHandler OnEditNotecard;
149 public event RunScriptHandlerByIDs OnRunScriptByIDs;
129 public event RunScriptHandler OnRunScript; 150 public event RunScriptHandler OnRunScript;
130 public event CompileScriptHandler OnCompileScript; 151 public event CompileScriptHandler OnCompileScript;
131 public event StartScriptHandler OnStartScript; 152 public event StartScriptHandler OnStartScript;
@@ -134,9 +155,9 @@ namespace OpenSim.Region.Framework.Scenes
134 public event TerraformLandHandler OnTerraformLand; 155 public event TerraformLandHandler OnTerraformLand;
135 public event RunConsoleCommandHandler OnRunConsoleCommand; 156 public event RunConsoleCommandHandler OnRunConsoleCommand;
136 public event IssueEstateCommandHandler OnIssueEstateCommand; 157 public event IssueEstateCommandHandler OnIssueEstateCommand;
137 public event IsGodHandler OnIsGod;
138 public event IsGridGodHandler OnIsGridGod; 158 public event IsGridGodHandler OnIsGridGod;
139 public event IsAdministratorHandler OnIsAdministrator; 159 public event IsAdministratorHandler OnIsAdministrator;
160 public event IsEstateManagerHandler OnIsEstateManager;
140// public event EditParcelHandler OnEditParcel; 161// public event EditParcelHandler OnEditParcel;
141 public event EditParcelPropertiesHandler OnEditParcelProperties; 162 public event EditParcelPropertiesHandler OnEditParcelProperties;
142 public event SellParcelHandler OnSellParcel; 163 public event SellParcelHandler OnSellParcel;
@@ -149,6 +170,8 @@ namespace OpenSim.Region.Framework.Scenes
149 public event DelinkObjectHandler OnDelinkObject; 170 public event DelinkObjectHandler OnDelinkObject;
150 public event CreateObjectInventoryHandler OnCreateObjectInventory; 171 public event CreateObjectInventoryHandler OnCreateObjectInventory;
151 public event CopyObjectInventoryHandler OnCopyObjectInventory; 172 public event CopyObjectInventoryHandler OnCopyObjectInventory;
173 public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
174 public event DoDropInObjectInv OnDropInObjectInv;
152 public event DeleteObjectInventoryHandler OnDeleteObjectInventory; 175 public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
153 public event TransferObjectInventoryHandler OnTransferObjectInventory; 176 public event TransferObjectInventoryHandler OnTransferObjectInventory;
154 public event CreateUserInventoryHandler OnCreateUserInventory; 177 public event CreateUserInventoryHandler OnCreateUserInventory;
@@ -163,7 +186,7 @@ namespace OpenSim.Region.Framework.Scenes
163 186
164 #region Object Permission Checks 187 #region Object Permission Checks
165 188
166 public uint GenerateClientFlags(UUID userID, UUID objectID) 189 public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp)
167 { 190 {
168 // libomv will moan about PrimFlags.ObjectYouOfficer being 191 // libomv will moan about PrimFlags.ObjectYouOfficer being
169 // obsolete... 192 // obsolete...
@@ -175,12 +198,9 @@ namespace OpenSim.Region.Framework.Scenes
175 PrimFlags.ObjectTransfer | 198 PrimFlags.ObjectTransfer |
176 PrimFlags.ObjectYouOwner | 199 PrimFlags.ObjectYouOwner |
177 PrimFlags.ObjectAnyOwner | 200 PrimFlags.ObjectAnyOwner |
178 PrimFlags.ObjectOwnerModify | 201 PrimFlags.ObjectOwnerModify;
179 PrimFlags.ObjectYouOfficer;
180#pragma warning restore 0612 202#pragma warning restore 0612
181 203
182 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
183
184 if (part == null) 204 if (part == null)
185 return 0; 205 return 0;
186 206
@@ -192,7 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
192 Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); 212 Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
193 foreach (GenerateClientFlagsHandler check in list) 213 foreach (GenerateClientFlagsHandler check in list)
194 { 214 {
195 perms &= check(userID, objectID); 215 perms &= check(part, sp, perms);
196 } 216 }
197 } 217 }
198 return perms; 218 return perms;
@@ -244,7 +264,7 @@ namespace OpenSim.Region.Framework.Scenes
244 Delegate[] list = handler.GetInvocationList(); 264 Delegate[] list = handler.GetInvocationList();
245 foreach (RezObjectHandler h in list) 265 foreach (RezObjectHandler h in list)
246 { 266 {
247 if (h(objectCount, owner,objectPosition, m_scene) == false) 267 if (h(objectCount, owner,objectPosition) == false)
248 return false; 268 return false;
249 } 269 }
250 } 270 }
@@ -257,113 +277,184 @@ namespace OpenSim.Region.Framework.Scenes
257 public bool CanDeleteObject(UUID objectID, UUID deleter) 277 public bool CanDeleteObject(UUID objectID, UUID deleter)
258 { 278 {
259 bool result = true; 279 bool result = true;
260 280
261 DeleteObjectHandler handler = OnDeleteObject; 281 DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
262 if (handler != null) 282 if (handler != null)
263 { 283 {
264 Delegate[] list = handler.GetInvocationList(); 284 Delegate[] list = handler.GetInvocationList();
265 foreach (DeleteObjectHandler h in list) 285 foreach (DeleteObjectHandlerByIDs h in list)
266 { 286 {
267 if (h(objectID, deleter, m_scene) == false) 287 if (h(objectID, deleter) == false)
268 { 288 {
269 result = false; 289 result = false;
270 break; 290 break;
271 } 291 }
272 } 292 }
273 } 293 }
274
275 return result; 294 return result;
276 } 295 }
277 296
297 public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
298 {
299 DeleteObjectHandler handler = OnDeleteObject;
300 if (handler != null)
301 {
302 if(sog == null || client == null || client.SceneAgent == null)
303 return false;
304
305 ScenePresence sp = client.SceneAgent as ScenePresence;
306
307 Delegate[] list = handler.GetInvocationList();
308 foreach (DeleteObjectHandler h in list)
309 {
310 if (h(sog, sp) == false)
311 return false;
312 }
313 }
314
315 return true;
316 }
317
278 public bool CanTransferObject(UUID objectID, UUID recipient) 318 public bool CanTransferObject(UUID objectID, UUID recipient)
279 { 319 {
280 bool result = true;
281
282 TransferObjectHandler handler = OnTransferObject; 320 TransferObjectHandler handler = OnTransferObject;
283 if (handler != null) 321 if (handler != null)
284 { 322 {
285 Delegate[] list = handler.GetInvocationList(); 323 Delegate[] list = handler.GetInvocationList();
286 foreach (TransferObjectHandler h in list) 324 foreach (TransferObjectHandler h in list)
287 { 325 {
288 if (h(objectID, recipient, m_scene) == false) 326 if (h(objectID, recipient) == false)
289 { 327 return false;
290 result = false;
291 break;
292 }
293 } 328 }
294 } 329 }
295 330 return true;
296 return result;
297 } 331 }
298 332
299 #endregion 333 #endregion
300 334
301 #region TAKE OBJECT 335 #region TAKE OBJECT
302 public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) 336 public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
303 { 337 {
304 bool result = true;
305
306 TakeObjectHandler handler = OnTakeObject; 338 TakeObjectHandler handler = OnTakeObject;
307 if (handler != null) 339 if (handler != null)
308 { 340 {
341 if(sog == null || sp == null)
342 return false;
343
309 Delegate[] list = handler.GetInvocationList(); 344 Delegate[] list = handler.GetInvocationList();
310 foreach (TakeObjectHandler h in list) 345 foreach (TakeObjectHandler h in list)
311 { 346 {
312 if (h(objectID, AvatarTakingUUID, m_scene) == false) 347 if (h(sog, sp) == false)
313 { 348 return false;
314 result = false;
315 break;
316 }
317 } 349 }
318 } 350 }
319
320// m_log.DebugFormat( 351// m_log.DebugFormat(
321// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", 352// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
322// objectID, AvatarTakingUUID, result); 353// objectID, AvatarTakingUUID, result);
323 354 return true;
324 return result;
325 } 355 }
326 356
327 #endregion 357 #endregion
328 358
359 #region SELL GROUP OBJECT
360 public bool CanSellGroupObject(UUID userID, UUID groupID)
361 {
362 SellGroupObjectHandler handler = OnSellGroupObject;
363 if (handler != null)
364 {
365 Delegate[] list = handler.GetInvocationList();
366 foreach (SellGroupObjectHandler h in list)
367 {
368 if (h(userID, groupID) == false)
369 return false;
370 }
371 }
372 //m_log.DebugFormat(
373 // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
374 // userID, groupID, result);
375 return true;
376 }
377
378 #endregion
379
380 #region SELL OBJECT
381 public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType)
382 {
383 SellObjectHandler handler = OnSellObject;
384 if (handler != null)
385 {
386 if(sog == null || client == null || client.SceneAgent == null)
387 return false;
388
389 ScenePresence sp = client.SceneAgent as ScenePresence;
390 Delegate[] list = handler.GetInvocationList();
391 foreach (SellObjectHandler h in list)
392 {
393 if (h(sog, sp, saleType) == false)
394 return false;
395 }
396 }
397 return true;
398 }
399
400 public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType)
401 {
402 SellObjectHandlerByUserID handler = OnSellObjectByUserID;
403 if (handler != null)
404 {
405 if(sog == null)
406 return false;
407 Delegate[] list = handler.GetInvocationList();
408 foreach (SellObjectHandlerByUserID h in list)
409 {
410 if (h(sog, userID, saleType) == false)
411 return false;
412 }
413 }
414 return true;
415 }
416
417 #endregion
418
419
329 #region TAKE COPY OBJECT 420 #region TAKE COPY OBJECT
330 public bool CanTakeCopyObject(UUID objectID, UUID userID) 421 public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
331 { 422 {
332 bool result = true;
333
334 TakeCopyObjectHandler handler = OnTakeCopyObject; 423 TakeCopyObjectHandler handler = OnTakeCopyObject;
335 if (handler != null) 424 if (handler != null)
336 { 425 {
426 if(sog == null || sp == null)
427 return false;
337 Delegate[] list = handler.GetInvocationList(); 428 Delegate[] list = handler.GetInvocationList();
338 foreach (TakeCopyObjectHandler h in list) 429 foreach (TakeCopyObjectHandler h in list)
339 { 430 {
340 if (h(objectID, userID, m_scene) == false) 431 if (h(sog, sp) == false)
341 { 432 return false;
342 result = false;
343 break;
344 }
345 } 433 }
346 } 434 }
347
348// m_log.DebugFormat( 435// m_log.DebugFormat(
349// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", 436// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
350// objectID, userID, result); 437// objectID, userID, result);
351 438 return true;
352 return result;
353 } 439 }
354 440
355 #endregion 441 #endregion
356 442
357 #region DUPLICATE OBJECT 443 #region DUPLICATE OBJECT
358 public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) 444 public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID)
359 { 445 {
360 DuplicateObjectHandler handler = OnDuplicateObject; 446 DuplicateObjectHandler handler = OnDuplicateObject;
361 if (handler != null) 447 if (handler != null)
362 { 448 {
449 if(sog == null || sog.IsDeleted)
450 return false;
451 ScenePresence sp = m_scene.GetScenePresence(agentID);
452 if(sp == null || sp.IsDeleted)
453 return false;
363 Delegate[] list = handler.GetInvocationList(); 454 Delegate[] list = handler.GetInvocationList();
364 foreach (DuplicateObjectHandler h in list) 455 foreach (DuplicateObjectHandler h in list)
365 { 456 {
366 if (h(objectCount, objectID, owner, m_scene, objectPosition) == false) 457 if (h(sog, sp) == false)
367 return false; 458 return false;
368 } 459 }
369 } 460 }
@@ -372,22 +463,74 @@ namespace OpenSim.Region.Framework.Scenes
372 463
373 #endregion 464 #endregion
374 465
466 #region persence EDIT or MOVE OBJECT
467 private const uint CANSELECTMASK = (uint)(
468 PrimFlags.ObjectMove |
469 PrimFlags.ObjectModify |
470 PrimFlags.ObjectOwnerModify
471 );
472
473 public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp)
474 {
475 uint perms = GenerateClientFlags(part, sp);
476 return (perms & CANSELECTMASK) != 0;
477 }
478
479 #endregion
375 #region EDIT OBJECT 480 #region EDIT OBJECT
376 public bool CanEditObject(UUID objectID, UUID editorID) 481 public bool CanEditObject(UUID objectID, UUID editorID)
377 { 482 {
483 EditObjectByIDsHandler handler = OnEditObjectByIDs;
484 if (handler != null)
485 {
486 Delegate[] list = handler.GetInvocationList();
487 foreach (EditObjectByIDsHandler h in list)
488 {
489 if (h(objectID, editorID) == false)
490 return false;
491 }
492 }
493 return true;
494 }
495
496 public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
497 {
378 EditObjectHandler handler = OnEditObject; 498 EditObjectHandler handler = OnEditObject;
379 if (handler != null) 499 if (handler != null)
380 { 500 {
501 if(sog == null || client == null || client.SceneAgent == null)
502 return false;
503
504 ScenePresence sp = client.SceneAgent as ScenePresence;
505
381 Delegate[] list = handler.GetInvocationList(); 506 Delegate[] list = handler.GetInvocationList();
382 foreach (EditObjectHandler h in list) 507 foreach (EditObjectHandler h in list)
383 { 508 {
384 if (h(objectID, editorID, m_scene) == false) 509 if (h(sog, sp) == false)
510 return false;
511 }
512 }
513 return true;
514 }
515
516 public bool CanEditObjectPermissions(SceneObjectGroup sog, UUID editorID)
517 {
518 EditObjectPermsHandler handler = OnEditObjectPerms;
519 if (handler != null)
520 {
521 if(sog == null)
522 return false;
523 Delegate[] list = handler.GetInvocationList();
524 foreach (EditObjectPermsHandler h in list)
525 {
526 if (h(sog, editorID) == false)
385 return false; 527 return false;
386 } 528 }
387 } 529 }
388 return true; 530 return true;
389 } 531 }
390 532
533
391 public bool CanEditObjectInventory(UUID objectID, UUID editorID) 534 public bool CanEditObjectInventory(UUID objectID, UUID editorID)
392 { 535 {
393 EditObjectInventoryHandler handler = OnEditObjectInventory; 536 EditObjectInventoryHandler handler = OnEditObjectInventory;
@@ -396,7 +539,7 @@ namespace OpenSim.Region.Framework.Scenes
396 Delegate[] list = handler.GetInvocationList(); 539 Delegate[] list = handler.GetInvocationList();
397 foreach (EditObjectInventoryHandler h in list) 540 foreach (EditObjectInventoryHandler h in list)
398 { 541 {
399 if (h(objectID, editorID, m_scene) == false) 542 if (h(objectID, editorID) == false)
400 return false; 543 return false;
401 } 544 }
402 } 545 }
@@ -406,15 +549,20 @@ namespace OpenSim.Region.Framework.Scenes
406 #endregion 549 #endregion
407 550
408 #region MOVE OBJECT 551 #region MOVE OBJECT
409 public bool CanMoveObject(UUID objectID, UUID moverID) 552 public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
410 { 553 {
411 MoveObjectHandler handler = OnMoveObject; 554 MoveObjectHandler handler = OnMoveObject;
412 if (handler != null) 555 if (handler != null)
413 { 556 {
557 if(sog == null || client == null || client.SceneAgent == null)
558 return false;
559
560 ScenePresence sp = client.SceneAgent as ScenePresence;
561
414 Delegate[] list = handler.GetInvocationList(); 562 Delegate[] list = handler.GetInvocationList();
415 foreach (MoveObjectHandler h in list) 563 foreach (MoveObjectHandler h in list)
416 { 564 {
417 if (h(objectID, moverID, m_scene) == false) 565 if (h(sog, sp) == false)
418 return false; 566 return false;
419 } 567 }
420 } 568 }
@@ -424,7 +572,7 @@ namespace OpenSim.Region.Framework.Scenes
424 #endregion 572 #endregion
425 573
426 #region OBJECT ENTRY 574 #region OBJECT ENTRY
427 public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint) 575 public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
428 { 576 {
429 ObjectEntryHandler handler = OnObjectEntry; 577 ObjectEntryHandler handler = OnObjectEntry;
430 if (handler != null) 578 if (handler != null)
@@ -432,7 +580,22 @@ namespace OpenSim.Region.Framework.Scenes
432 Delegate[] list = handler.GetInvocationList(); 580 Delegate[] list = handler.GetInvocationList();
433 foreach (ObjectEntryHandler h in list) 581 foreach (ObjectEntryHandler h in list)
434 { 582 {
435 if (h(objectID, enteringRegion, newPoint, m_scene) == false) 583 if (h(sog, enteringRegion, newPoint) == false)
584 return false;
585 }
586 }
587 return true;
588 }
589
590 public bool CanObjectEnterWithScripts(SceneObjectGroup sog, ILandObject land)
591 {
592 ObjectEnterWithScriptsHandler handler = OnObjectEnterWithScripts;
593 if (handler != null)
594 {
595 Delegate[] list = handler.GetInvocationList();
596 foreach (ObjectEnterWithScriptsHandler h in list)
597 {
598 if (h(sog, land) == false)
436 return false; 599 return false;
437 } 600 }
438 } 601 }
@@ -442,29 +605,30 @@ namespace OpenSim.Region.Framework.Scenes
442 #endregion 605 #endregion
443 606
444 #region RETURN OBJECT 607 #region RETURN OBJECT
445 public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) 608 public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
446 { 609 {
447 bool result = true;
448
449 ReturnObjectsHandler handler = OnReturnObjects; 610 ReturnObjectsHandler handler = OnReturnObjects;
450 if (handler != null) 611 if (handler != null)
451 { 612 {
613 if(objects == null)
614 return false;
615
616 ScenePresence sp = null;
617 if(client != null && client.SceneAgent != null)
618 sp = client.SceneAgent as ScenePresence;
619
452 Delegate[] list = handler.GetInvocationList(); 620 Delegate[] list = handler.GetInvocationList();
453 foreach (ReturnObjectsHandler h in list) 621 foreach (ReturnObjectsHandler h in list)
454 { 622 {
455 if (h(land, user, objects, m_scene) == false) 623 if (h(land, sp, objects) == false)
456 { 624 return false;
457 result = false;
458 break;
459 }
460 } 625 }
461 } 626 }
462
463// m_log.DebugFormat( 627// m_log.DebugFormat(
464// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", 628// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
465// user, objects.Count, land.LandData.Name, result); 629// user, objects.Count, land.LandData.Name, result);
466 630
467 return result; 631 return true;
468 } 632 }
469 633
470 #endregion 634 #endregion
@@ -478,7 +642,7 @@ namespace OpenSim.Region.Framework.Scenes
478 Delegate[] list = handler.GetInvocationList(); 642 Delegate[] list = handler.GetInvocationList();
479 foreach (InstantMessageHandler h in list) 643 foreach (InstantMessageHandler h in list)
480 { 644 {
481 if (h(user, target, m_scene) == false) 645 if (h(user, target) == false)
482 return false; 646 return false;
483 } 647 }
484 } 648 }
@@ -496,7 +660,7 @@ namespace OpenSim.Region.Framework.Scenes
496 Delegate[] list = handler.GetInvocationList(); 660 Delegate[] list = handler.GetInvocationList();
497 foreach (InventoryTransferHandler h in list) 661 foreach (InventoryTransferHandler h in list)
498 { 662 {
499 if (h(user, target, m_scene) == false) 663 if (h(user, target) == false)
500 return false; 664 return false;
501 } 665 }
502 } 666 }
@@ -514,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes
514 Delegate[] list = handler.GetInvocationList(); 678 Delegate[] list = handler.GetInvocationList();
515 foreach (ViewScriptHandler h in list) 679 foreach (ViewScriptHandler h in list)
516 { 680 {
517 if (h(script, objectID, user, m_scene) == false) 681 if (h(script, objectID, user) == false)
518 return false; 682 return false;
519 } 683 }
520 } 684 }
@@ -529,7 +693,7 @@ namespace OpenSim.Region.Framework.Scenes
529 Delegate[] list = handler.GetInvocationList(); 693 Delegate[] list = handler.GetInvocationList();
530 foreach (ViewNotecardHandler h in list) 694 foreach (ViewNotecardHandler h in list)
531 { 695 {
532 if (h(script, objectID, user, m_scene) == false) 696 if (h(script, objectID, user) == false)
533 return false; 697 return false;
534 } 698 }
535 } 699 }
@@ -547,7 +711,7 @@ namespace OpenSim.Region.Framework.Scenes
547 Delegate[] list = handler.GetInvocationList(); 711 Delegate[] list = handler.GetInvocationList();
548 foreach (EditScriptHandler h in list) 712 foreach (EditScriptHandler h in list)
549 { 713 {
550 if (h(script, objectID, user, m_scene) == false) 714 if (h(script, objectID, user) == false)
551 return false; 715 return false;
552 } 716 }
553 } 717 }
@@ -562,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes
562 Delegate[] list = handler.GetInvocationList(); 726 Delegate[] list = handler.GetInvocationList();
563 foreach (EditNotecardHandler h in list) 727 foreach (EditNotecardHandler h in list)
564 { 728 {
565 if (h(script, objectID, user, m_scene) == false) 729 if (h(script, objectID, user) == false)
566 return false; 730 return false;
567 } 731 }
568 } 732 }
@@ -574,19 +738,37 @@ namespace OpenSim.Region.Framework.Scenes
574 #region RUN SCRIPT (When Script Placed in Object) 738 #region RUN SCRIPT (When Script Placed in Object)
575 public bool CanRunScript(UUID script, UUID objectID, UUID user) 739 public bool CanRunScript(UUID script, UUID objectID, UUID user)
576 { 740 {
741 RunScriptHandlerByIDs handler = OnRunScriptByIDs;
742 if (handler != null)
743 {
744 Delegate[] list = handler.GetInvocationList();
745 foreach (RunScriptHandlerByIDs h in list)
746 {
747 if (h(script, objectID, user) == false)
748 return false;
749 }
750 }
751 return true;
752 }
753
754 public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
755 {
577 RunScriptHandler handler = OnRunScript; 756 RunScriptHandler handler = OnRunScript;
578 if (handler != null) 757 if (handler != null)
579 { 758 {
759 if(item == null || part == null)
760 return false;
580 Delegate[] list = handler.GetInvocationList(); 761 Delegate[] list = handler.GetInvocationList();
581 foreach (RunScriptHandler h in list) 762 foreach (RunScriptHandler h in list)
582 { 763 {
583 if (h(script, objectID, user, m_scene) == false) 764 if (h(item, part) == false)
584 return false; 765 return false;
585 } 766 }
586 } 767 }
587 return true; 768 return true;
588 } 769 }
589 770
771
590 #endregion 772 #endregion
591 773
592 #region COMPILE SCRIPT (When Script needs to get (re)compiled) 774 #region COMPILE SCRIPT (When Script needs to get (re)compiled)
@@ -598,7 +780,7 @@ namespace OpenSim.Region.Framework.Scenes
598 Delegate[] list = handler.GetInvocationList(); 780 Delegate[] list = handler.GetInvocationList();
599 foreach (CompileScriptHandler h in list) 781 foreach (CompileScriptHandler h in list)
600 { 782 {
601 if (h(ownerUUID, scriptType, m_scene) == false) 783 if (h(ownerUUID, scriptType) == false)
602 return false; 784 return false;
603 } 785 }
604 } 786 }
@@ -616,7 +798,7 @@ namespace OpenSim.Region.Framework.Scenes
616 Delegate[] list = handler.GetInvocationList(); 798 Delegate[] list = handler.GetInvocationList();
617 foreach (StartScriptHandler h in list) 799 foreach (StartScriptHandler h in list)
618 { 800 {
619 if (h(script, user, m_scene) == false) 801 if (h(script, user) == false)
620 return false; 802 return false;
621 } 803 }
622 } 804 }
@@ -634,7 +816,7 @@ namespace OpenSim.Region.Framework.Scenes
634 Delegate[] list = handler.GetInvocationList(); 816 Delegate[] list = handler.GetInvocationList();
635 foreach (StopScriptHandler h in list) 817 foreach (StopScriptHandler h in list)
636 { 818 {
637 if (h(script, user, m_scene) == false) 819 if (h(script, user) == false)
638 return false; 820 return false;
639 } 821 }
640 } 822 }
@@ -652,7 +834,7 @@ namespace OpenSim.Region.Framework.Scenes
652 Delegate[] list = handler.GetInvocationList(); 834 Delegate[] list = handler.GetInvocationList();
653 foreach (ResetScriptHandler h in list) 835 foreach (ResetScriptHandler h in list)
654 { 836 {
655 if (h(prim, script, user, m_scene) == false) 837 if (h(prim, script, user) == false)
656 return false; 838 return false;
657 } 839 }
658 } 840 }
@@ -670,7 +852,7 @@ namespace OpenSim.Region.Framework.Scenes
670 Delegate[] list = handler.GetInvocationList(); 852 Delegate[] list = handler.GetInvocationList();
671 foreach (TerraformLandHandler h in list) 853 foreach (TerraformLandHandler h in list)
672 { 854 {
673 if (h(user, pos, m_scene) == false) 855 if (h(user, pos) == false)
674 return false; 856 return false;
675 } 857 }
676 } 858 }
@@ -688,7 +870,7 @@ namespace OpenSim.Region.Framework.Scenes
688 Delegate[] list = handler.GetInvocationList(); 870 Delegate[] list = handler.GetInvocationList();
689 foreach (RunConsoleCommandHandler h in list) 871 foreach (RunConsoleCommandHandler h in list)
690 { 872 {
691 if (h(user, m_scene) == false) 873 if (h(user) == false)
692 return false; 874 return false;
693 } 875 }
694 } 876 }
@@ -706,7 +888,7 @@ namespace OpenSim.Region.Framework.Scenes
706 Delegate[] list = handler.GetInvocationList(); 888 Delegate[] list = handler.GetInvocationList();
707 foreach (IssueEstateCommandHandler h in list) 889 foreach (IssueEstateCommandHandler h in list)
708 { 890 {
709 if (h(user, m_scene, ownerCommand) == false) 891 if (h(user, ownerCommand) == false)
710 return false; 892 return false;
711 } 893 }
712 } 894 }
@@ -717,13 +899,13 @@ namespace OpenSim.Region.Framework.Scenes
717 #region CAN BE GODLIKE 899 #region CAN BE GODLIKE
718 public bool IsGod(UUID user) 900 public bool IsGod(UUID user)
719 { 901 {
720 IsGodHandler handler = OnIsGod; 902 IsAdministratorHandler handler = OnIsAdministrator;
721 if (handler != null) 903 if (handler != null)
722 { 904 {
723 Delegate[] list = handler.GetInvocationList(); 905 Delegate[] list = handler.GetInvocationList();
724 foreach (IsGodHandler h in list) 906 foreach (IsAdministratorHandler h in list)
725 { 907 {
726 if (h(user, m_scene) == false) 908 if (h(user) == false)
727 return false; 909 return false;
728 } 910 }
729 } 911 }
@@ -738,7 +920,7 @@ namespace OpenSim.Region.Framework.Scenes
738 Delegate[] list = handler.GetInvocationList(); 920 Delegate[] list = handler.GetInvocationList();
739 foreach (IsGridGodHandler h in list) 921 foreach (IsGridGodHandler h in list)
740 { 922 {
741 if (h(user, m_scene) == false) 923 if (h(user) == false)
742 return false; 924 return false;
743 } 925 }
744 } 926 }
@@ -761,9 +943,24 @@ namespace OpenSim.Region.Framework.Scenes
761 } 943 }
762 #endregion 944 #endregion
763 945
946 public bool IsEstateManager(UUID user)
947 {
948 IsEstateManagerHandler handler = OnIsEstateManager;
949 if (handler != null)
950 {
951 Delegate[] list = handler.GetInvocationList();
952 foreach (IsEstateManagerHandler h in list)
953 {
954 if (h(user) == false)
955 return false;
956 }
957 }
958 return true;
959 }
960
764 #region EDIT PARCEL 961 #region EDIT PARCEL
765 962
766 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) 963 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, bool allowManager)
767 { 964 {
768 EditParcelPropertiesHandler handler = OnEditParcelProperties; 965 EditParcelPropertiesHandler handler = OnEditParcelProperties;
769 if (handler != null) 966 if (handler != null)
@@ -771,7 +968,7 @@ namespace OpenSim.Region.Framework.Scenes
771 Delegate[] list = handler.GetInvocationList(); 968 Delegate[] list = handler.GetInvocationList();
772 foreach (EditParcelPropertiesHandler h in list) 969 foreach (EditParcelPropertiesHandler h in list)
773 { 970 {
774 if (h(user, parcel, p, m_scene) == false) 971 if (h(user, parcel, p, allowManager) == false)
775 return false; 972 return false;
776 } 973 }
777 } 974 }
@@ -788,7 +985,7 @@ namespace OpenSim.Region.Framework.Scenes
788 Delegate[] list = handler.GetInvocationList(); 985 Delegate[] list = handler.GetInvocationList();
789 foreach (SellParcelHandler h in list) 986 foreach (SellParcelHandler h in list)
790 { 987 {
791 if (h(user, parcel, m_scene) == false) 988 if (h(user, parcel) == false)
792 return false; 989 return false;
793 } 990 }
794 } 991 }
@@ -805,7 +1002,7 @@ namespace OpenSim.Region.Framework.Scenes
805 Delegate[] list = handler.GetInvocationList(); 1002 Delegate[] list = handler.GetInvocationList();
806 foreach (AbandonParcelHandler h in list) 1003 foreach (AbandonParcelHandler h in list)
807 { 1004 {
808 if (h(user, parcel, m_scene) == false) 1005 if (h(user, parcel) == false)
809 return false; 1006 return false;
810 } 1007 }
811 } 1008 }
@@ -821,7 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes
821 Delegate[] list = handler.GetInvocationList(); 1018 Delegate[] list = handler.GetInvocationList();
822 foreach (ReclaimParcelHandler h in list) 1019 foreach (ReclaimParcelHandler h in list)
823 { 1020 {
824 if (h(user, parcel, m_scene) == false) 1021 if (h(user, parcel) == false)
825 return false; 1022 return false;
826 } 1023 }
827 } 1024 }
@@ -836,22 +1033,27 @@ namespace OpenSim.Region.Framework.Scenes
836 Delegate[] list = handler.GetInvocationList(); 1033 Delegate[] list = handler.GetInvocationList();
837 foreach (DeedParcelHandler h in list) 1034 foreach (DeedParcelHandler h in list)
838 { 1035 {
839 if (h(user, parcel, m_scene) == false) 1036 if (h(user, parcel) == false)
840 return false; 1037 return false;
841 } 1038 }
842 } 1039 }
843 return true; 1040 return true;
844 } 1041 }
845 1042
846 public bool CanDeedObject(UUID user, UUID group) 1043 public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
847 { 1044 {
848 DeedObjectHandler handler = OnDeedObject; 1045 DeedObjectHandler handler = OnDeedObject;
849 if (handler != null) 1046 if (handler != null)
850 { 1047 {
1048 if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
1049 return false;
1050
1051 ScenePresence sp = client.SceneAgent as ScenePresence;
1052
851 Delegate[] list = handler.GetInvocationList(); 1053 Delegate[] list = handler.GetInvocationList();
852 foreach (DeedObjectHandler h in list) 1054 foreach (DeedObjectHandler h in list)
853 { 1055 {
854 if (h(user, group, m_scene) == false) 1056 if (h(sp, sog, targetGroupID) == false)
855 return false; 1057 return false;
856 } 1058 }
857 } 1059 }
@@ -866,7 +1068,7 @@ namespace OpenSim.Region.Framework.Scenes
866 Delegate[] list = handler.GetInvocationList(); 1068 Delegate[] list = handler.GetInvocationList();
867 foreach (BuyLandHandler h in list) 1069 foreach (BuyLandHandler h in list)
868 { 1070 {
869 if (h(user, parcel, m_scene) == false) 1071 if (h(user, parcel) == false)
870 return false; 1072 return false;
871 } 1073 }
872 } 1074 }
@@ -942,6 +1144,45 @@ namespace OpenSim.Region.Framework.Scenes
942 return true; 1144 return true;
943 } 1145 }
944 1146
1147 public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
1148 {
1149 DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
1150 if (handler != null)
1151 {
1152 if (sourcePart == null || destPart == null || item == null)
1153 return false;
1154 Delegate[] list = handler.GetInvocationList();
1155 foreach (DoObjectInvToObjectInv h in list)
1156 {
1157 if (h(item, sourcePart, destPart) == false)
1158 return false;
1159 }
1160 }
1161 return true;
1162 }
1163
1164 public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart)
1165 {
1166 DoDropInObjectInv handler = OnDropInObjectInv;
1167 if (handler != null)
1168 {
1169 if (client == null || client.SceneAgent == null|| destPart == null || item == null)
1170 return false;
1171
1172 ScenePresence sp = client.SceneAgent as ScenePresence;
1173 if(sp == null || sp.IsDeleted)
1174 return false;
1175
1176 Delegate[] list = handler.GetInvocationList();
1177 foreach (DoDropInObjectInv h in list)
1178 {
1179 if (h(item, sp, destPart) == false)
1180 return false;
1181 }
1182 }
1183 return true;
1184 }
1185
945 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) 1186 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
946 { 1187 {
947 DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; 1188 DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;
@@ -956,7 +1197,7 @@ namespace OpenSim.Region.Framework.Scenes
956 } 1197 }
957 return true; 1198 return true;
958 } 1199 }
959 1200
960 public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID) 1201 public bool CanTransferObjectInventory(UUID itemID, UUID objectID, UUID userID)
961 { 1202 {
962 TransferObjectInventoryHandler handler = OnTransferObjectInventory; 1203 TransferObjectInventoryHandler handler = OnTransferObjectInventory;
@@ -971,7 +1212,7 @@ namespace OpenSim.Region.Framework.Scenes
971 } 1212 }
972 return true; 1213 return true;
973 } 1214 }
974 1215
975 /// <summary> 1216 /// <summary>
976 /// Check whether the specified user is allowed to create the given inventory type in their inventory. 1217 /// Check whether the specified user is allowed to create the given inventory type in their inventory.
977 /// </summary> 1218 /// </summary>
@@ -991,8 +1232,8 @@ namespace OpenSim.Region.Framework.Scenes
991 } 1232 }
992 } 1233 }
993 return true; 1234 return true;
994 } 1235 }
995 1236
996 /// <summary> 1237 /// <summary>
997 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 1238 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
998 /// </summary> 1239 /// </summary>
@@ -1013,7 +1254,7 @@ namespace OpenSim.Region.Framework.Scenes
1013 } 1254 }
1014 return true; 1255 return true;
1015 } 1256 }
1016 1257
1017 /// <summary> 1258 /// <summary>
1018 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory. 1259 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
1019 /// </summary> 1260 /// </summary>
@@ -1034,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes
1034 } 1275 }
1035 return true; 1276 return true;
1036 } 1277 }
1037 1278
1038 /// <summary> 1279 /// <summary>
1039 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 1280 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1040 /// </summary> 1281 /// </summary>
@@ -1055,7 +1296,7 @@ namespace OpenSim.Region.Framework.Scenes
1055 } 1296 }
1056 return true; 1297 return true;
1057 } 1298 }
1058 1299
1059 public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID) 1300 public bool CanTransferUserInventory(UUID itemID, UUID userID, UUID recipientID)
1060 { 1301 {
1061 TransferUserInventoryHandler handler = OnTransferUserInventory; 1302 TransferUserInventoryHandler handler = OnTransferUserInventory;
@@ -1070,7 +1311,7 @@ namespace OpenSim.Region.Framework.Scenes
1070 } 1311 }
1071 return true; 1312 return true;
1072 } 1313 }
1073 1314
1074 public bool CanTeleport(UUID userID) 1315 public bool CanTeleport(UUID userID)
1075 { 1316 {
1076 TeleportHandler handler = OnTeleport; 1317 TeleportHandler handler = OnTeleport;
@@ -1085,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
1085 } 1326 }
1086 return true; 1327 return true;
1087 } 1328 }
1088 1329
1089 public bool CanControlPrimMedia(UUID userID, UUID primID, int face) 1330 public bool CanControlPrimMedia(UUID userID, UUID primID, int face)
1090 { 1331 {
1091 ControlPrimMediaHandler handler = OnControlPrimMedia; 1332 ControlPrimMediaHandler handler = OnControlPrimMedia;
@@ -1099,8 +1340,8 @@ namespace OpenSim.Region.Framework.Scenes
1099 } 1340 }
1100 } 1341 }
1101 return true; 1342 return true;
1102 } 1343 }
1103 1344
1104 public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face) 1345 public bool CanInteractWithPrimMedia(UUID userID, UUID primID, int face)
1105 { 1346 {
1106 InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia; 1347 InteractWithPrimMediaHandler handler = OnInteractWithPrimMedia;