aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Permissions.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs315
1 files changed, 226 insertions, 89 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 8f32b03..6d3b82f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -37,52 +37,57 @@ using OpenSim.Region.Framework.Interfaces;
37namespace OpenSim.Region.Framework.Scenes 37namespace OpenSim.Region.Framework.Scenes
38{ 38{
39 #region Delegates 39 #region Delegates
40 public delegate uint GenerateClientFlagsHandler(ScenePresence sp, uint curEffectivePerms, 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 SellGroupObjectHandler(UUID userID, UUID groupID, Scene scene); 48 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
49 public delegate bool TakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene); 49 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
50 public delegate bool DuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition); 50 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
51 public delegate bool EditObjectHandler(UUID objectID, UUID editorID, Scene scene); 51 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
52 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene); 52 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
53 public delegate bool MoveObjectHandler(UUID objectID, UUID moverID, Scene scene); 53 public delegate bool EditObjectHandler(SceneObjectGroup sog, ScenePresence sp);
54 public delegate bool ObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene); 54 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
55 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects, Scene scene); 55 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
56 public delegate bool InstantMessageHandler(UUID user, UUID target, Scene startScene); 56 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
57 public delegate bool InventoryTransferHandler(UUID user, UUID target, Scene startScene); 57 public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects);
58 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 58 public delegate bool InstantMessageHandler(UUID user, UUID target);
59 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); 59 public delegate bool InventoryTransferHandler(UUID user, UUID target);
60 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 60 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
61 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); 61 public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user);
62 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 62 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user);
63 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); 63 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user);
64 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); 64 public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user);
65 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); 65 public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part);
66 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene); 66 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType);
67 public delegate bool TerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene); 67 public delegate bool StartScriptHandler(UUID script, UUID user);
68 public delegate bool RunConsoleCommandHandler(UUID user, Scene requestFromScene); 68 public delegate bool StopScriptHandler(UUID script, UUID user);
69 public delegate bool IssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand); 69 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user);
70 public delegate bool IsGodHandler(UUID user, Scene requestFromScene); 70 public delegate bool TerraformLandHandler(UUID user, Vector3 position);
71 public delegate bool IsGridGodHandler(UUID user, Scene requestFromScene); 71 public delegate bool RunConsoleCommandHandler(UUID user);
72 public delegate bool IssueEstateCommandHandler(UUID user, bool ownerCommand);
73 public delegate bool IsGodHandler(UUID user);
74 public delegate bool IsGridGodHandler(UUID user);
72 public delegate bool IsAdministratorHandler(UUID user); 75 public delegate bool IsAdministratorHandler(UUID user);
73 public delegate bool IsEstateManagerHandler(UUID user); 76 public delegate bool IsEstateManagerHandler(UUID user);
74 public delegate bool EditParcelHandler(UUID user, ILandObject parcel, Scene scene); 77 public delegate bool EditParcelHandler(UUID user, ILandObject parcel);
75 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager); 78 public delegate bool EditParcelPropertiesHandler(UUID user, ILandObject parcel, GroupPowers p, bool allowManager);
76 public delegate bool SellParcelHandler(UUID user, ILandObject parcel, Scene scene); 79 public delegate bool SellParcelHandler(UUID user, ILandObject parcel);
77 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene); 80 public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel);
78 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene); 81 public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel);
79 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene); 82 public delegate bool DeedParcelHandler(UUID user, ILandObject parcel);
80 public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene); 83 public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
81 public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene); 84 public delegate bool BuyLandHandler(UUID user, ILandObject parcel);
82 public delegate bool LinkObjectHandler(UUID user, UUID objectID); 85 public delegate bool LinkObjectHandler(UUID user, UUID objectID);
83 public delegate bool DelinkObjectHandler(UUID user, UUID objectID); 86 public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
84 public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID); 87 public delegate bool CreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
85 public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 88 public delegate bool CopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
89 public delegate bool DoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart);
90 public delegate bool DoDropInObjectInv(InventoryItemBase item, ScenePresence sp, SceneObjectPart destPart);
86 public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 91 public delegate bool DeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
87 public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID); 92 public delegate bool TransferObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
88 public delegate bool CreateUserInventoryHandler(int invType, UUID userID); 93 public delegate bool CreateUserInventoryHandler(int invType, UUID userID);
@@ -112,12 +117,14 @@ namespace OpenSim.Region.Framework.Scenes
112 public event BypassPermissionsHandler OnBypassPermissions; 117 public event BypassPermissionsHandler OnBypassPermissions;
113 public event PropagatePermissionsHandler OnPropagatePermissions; 118 public event PropagatePermissionsHandler OnPropagatePermissions;
114 public event RezObjectHandler OnRezObject; 119 public event RezObjectHandler OnRezObject;
120 public event DeleteObjectHandlerByIDs OnDeleteObjectByIDs;
115 public event DeleteObjectHandler OnDeleteObject; 121 public event DeleteObjectHandler OnDeleteObject;
116 public event TransferObjectHandler OnTransferObject; 122 public event TransferObjectHandler OnTransferObject;
117 public event TakeObjectHandler OnTakeObject; 123 public event TakeObjectHandler OnTakeObject;
118 public event SellGroupObjectHandler OnSellGroupObject; 124 public event SellGroupObjectHandler OnSellGroupObject;
119 public event TakeCopyObjectHandler OnTakeCopyObject; 125 public event TakeCopyObjectHandler OnTakeCopyObject;
120 public event DuplicateObjectHandler OnDuplicateObject; 126 public event DuplicateObjectHandler OnDuplicateObject;
127 public event EditObjectByIDsHandler OnEditObjectByIDs;
121 public event EditObjectHandler OnEditObject; 128 public event EditObjectHandler OnEditObject;
122 public event EditObjectInventoryHandler OnEditObjectInventory; 129 public event EditObjectInventoryHandler OnEditObjectInventory;
123 public event MoveObjectHandler OnMoveObject; 130 public event MoveObjectHandler OnMoveObject;
@@ -129,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes
129 public event ViewNotecardHandler OnViewNotecard; 136 public event ViewNotecardHandler OnViewNotecard;
130 public event EditScriptHandler OnEditScript; 137 public event EditScriptHandler OnEditScript;
131 public event EditNotecardHandler OnEditNotecard; 138 public event EditNotecardHandler OnEditNotecard;
139 public event RunScriptHandlerByIDs OnRunScriptByIDs;
132 public event RunScriptHandler OnRunScript; 140 public event RunScriptHandler OnRunScript;
133 public event CompileScriptHandler OnCompileScript; 141 public event CompileScriptHandler OnCompileScript;
134 public event StartScriptHandler OnStartScript; 142 public event StartScriptHandler OnStartScript;
@@ -137,7 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
137 public event TerraformLandHandler OnTerraformLand; 145 public event TerraformLandHandler OnTerraformLand;
138 public event RunConsoleCommandHandler OnRunConsoleCommand; 146 public event RunConsoleCommandHandler OnRunConsoleCommand;
139 public event IssueEstateCommandHandler OnIssueEstateCommand; 147 public event IssueEstateCommandHandler OnIssueEstateCommand;
140 public event IsGodHandler OnIsGod;
141 public event IsGridGodHandler OnIsGridGod; 148 public event IsGridGodHandler OnIsGridGod;
142 public event IsAdministratorHandler OnIsAdministrator; 149 public event IsAdministratorHandler OnIsAdministrator;
143 public event IsEstateManagerHandler OnIsEstateManager; 150 public event IsEstateManagerHandler OnIsEstateManager;
@@ -153,6 +160,8 @@ namespace OpenSim.Region.Framework.Scenes
153 public event DelinkObjectHandler OnDelinkObject; 160 public event DelinkObjectHandler OnDelinkObject;
154 public event CreateObjectInventoryHandler OnCreateObjectInventory; 161 public event CreateObjectInventoryHandler OnCreateObjectInventory;
155 public event CopyObjectInventoryHandler OnCopyObjectInventory; 162 public event CopyObjectInventoryHandler OnCopyObjectInventory;
163 public event DoObjectInvToObjectInv OnDoObjectInvToObjectInv;
164 public event DoDropInObjectInv OnDropInObjectInv;
156 public event DeleteObjectInventoryHandler OnDeleteObjectInventory; 165 public event DeleteObjectInventoryHandler OnDeleteObjectInventory;
157 public event TransferObjectInventoryHandler OnTransferObjectInventory; 166 public event TransferObjectInventoryHandler OnTransferObjectInventory;
158 public event CreateUserInventoryHandler OnCreateUserInventory; 167 public event CreateUserInventoryHandler OnCreateUserInventory;
@@ -167,7 +176,7 @@ namespace OpenSim.Region.Framework.Scenes
167 176
168 #region Object Permission Checks 177 #region Object Permission Checks
169 178
170 public uint GenerateClientFlags(ScenePresence sp, UUID objectID) 179 public uint GenerateClientFlags( SceneObjectPart part, ScenePresence sp)
171 { 180 {
172 // libomv will moan about PrimFlags.ObjectYouOfficer being 181 // libomv will moan about PrimFlags.ObjectYouOfficer being
173 // obsolete... 182 // obsolete...
@@ -182,8 +191,6 @@ namespace OpenSim.Region.Framework.Scenes
182 PrimFlags.ObjectOwnerModify; 191 PrimFlags.ObjectOwnerModify;
183#pragma warning restore 0612 192#pragma warning restore 0612
184 193
185 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID);
186
187 if (part == null) 194 if (part == null)
188 return 0; 195 return 0;
189 196
@@ -195,7 +202,7 @@ namespace OpenSim.Region.Framework.Scenes
195 Delegate[] list = handlerGenerateClientFlags.GetInvocationList(); 202 Delegate[] list = handlerGenerateClientFlags.GetInvocationList();
196 foreach (GenerateClientFlagsHandler check in list) 203 foreach (GenerateClientFlagsHandler check in list)
197 { 204 {
198 perms &= check(sp, perms, objectID); 205 perms &= check(part, sp, perms);
199 } 206 }
200 } 207 }
201 return perms; 208 return perms;
@@ -247,7 +254,7 @@ namespace OpenSim.Region.Framework.Scenes
247 Delegate[] list = handler.GetInvocationList(); 254 Delegate[] list = handler.GetInvocationList();
248 foreach (RezObjectHandler h in list) 255 foreach (RezObjectHandler h in list)
249 { 256 {
250 if (h(objectCount, owner,objectPosition, m_scene) == false) 257 if (h(objectCount, owner,objectPosition) == false)
251 return false; 258 return false;
252 } 259 }
253 } 260 }
@@ -261,13 +268,39 @@ namespace OpenSim.Region.Framework.Scenes
261 { 268 {
262 bool result = true; 269 bool result = true;
263 270
271 DeleteObjectHandlerByIDs handler = OnDeleteObjectByIDs;
272 if (handler != null)
273 {
274 Delegate[] list = handler.GetInvocationList();
275 foreach (DeleteObjectHandlerByIDs h in list)
276 {
277 if (h(objectID, deleter) == false)
278 {
279 result = false;
280 break;
281 }
282 }
283 }
284
285 return result;
286 }
287
288 public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
289 {
290 bool result = true;
291
264 DeleteObjectHandler handler = OnDeleteObject; 292 DeleteObjectHandler handler = OnDeleteObject;
265 if (handler != null) 293 if (handler != null)
266 { 294 {
295 if(sog == null || client == null || client.SceneAgent == null)
296 return false;
297
298 ScenePresence sp = client.SceneAgent as ScenePresence;
299
267 Delegate[] list = handler.GetInvocationList(); 300 Delegate[] list = handler.GetInvocationList();
268 foreach (DeleteObjectHandler h in list) 301 foreach (DeleteObjectHandler h in list)
269 { 302 {
270 if (h(objectID, deleter, m_scene) == false) 303 if (h(sog, sp) == false)
271 { 304 {
272 result = false; 305 result = false;
273 break; 306 break;
@@ -288,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
288 Delegate[] list = handler.GetInvocationList(); 321 Delegate[] list = handler.GetInvocationList();
289 foreach (TransferObjectHandler h in list) 322 foreach (TransferObjectHandler h in list)
290 { 323 {
291 if (h(objectID, recipient, m_scene) == false) 324 if (h(objectID, recipient) == false)
292 { 325 {
293 result = false; 326 result = false;
294 break; 327 break;
@@ -302,17 +335,20 @@ namespace OpenSim.Region.Framework.Scenes
302 #endregion 335 #endregion
303 336
304 #region TAKE OBJECT 337 #region TAKE OBJECT
305 public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) 338 public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
306 { 339 {
307 bool result = true; 340 bool result = true;
308 341
309 TakeObjectHandler handler = OnTakeObject; 342 TakeObjectHandler handler = OnTakeObject;
310 if (handler != null) 343 if (handler != null)
311 { 344 {
345 if(sog == null || sp == null)
346 return false;
347
312 Delegate[] list = handler.GetInvocationList(); 348 Delegate[] list = handler.GetInvocationList();
313 foreach (TakeObjectHandler h in list) 349 foreach (TakeObjectHandler h in list)
314 { 350 {
315 if (h(objectID, AvatarTakingUUID, m_scene) == false) 351 if (h(sog, sp) == false)
316 { 352 {
317 result = false; 353 result = false;
318 break; 354 break;
@@ -330,7 +366,7 @@ namespace OpenSim.Region.Framework.Scenes
330 #endregion 366 #endregion
331 367
332 #region SELL GROUP OBJECT 368 #region SELL GROUP OBJECT
333 public bool CanSellGroupObject(UUID userID, UUID groupID, Scene scene) 369 public bool CanSellGroupObject(UUID userID, UUID groupID)
334 { 370 {
335 bool result = true; 371 bool result = true;
336 372
@@ -340,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes
340 Delegate[] list = handler.GetInvocationList(); 376 Delegate[] list = handler.GetInvocationList();
341 foreach (SellGroupObjectHandler h in list) 377 foreach (SellGroupObjectHandler h in list)
342 { 378 {
343 if (h(userID, groupID, scene) == false) 379 if (h(userID, groupID) == false)
344 { 380 {
345 result = false; 381 result = false;
346 break; 382 break;
@@ -359,17 +395,19 @@ namespace OpenSim.Region.Framework.Scenes
359 395
360 396
361 #region TAKE COPY OBJECT 397 #region TAKE COPY OBJECT
362 public bool CanTakeCopyObject(UUID objectID, UUID userID) 398 public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
363 { 399 {
364 bool result = true; 400 bool result = true;
365 401
366 TakeCopyObjectHandler handler = OnTakeCopyObject; 402 TakeCopyObjectHandler handler = OnTakeCopyObject;
367 if (handler != null) 403 if (handler != null)
368 { 404 {
405 if(sog == null || sp == null)
406 return false;
369 Delegate[] list = handler.GetInvocationList(); 407 Delegate[] list = handler.GetInvocationList();
370 foreach (TakeCopyObjectHandler h in list) 408 foreach (TakeCopyObjectHandler h in list)
371 { 409 {
372 if (h(objectID, userID, m_scene) == false) 410 if (h(sog, sp) == false)
373 { 411 {
374 result = false; 412 result = false;
375 break; 413 break;
@@ -387,15 +425,20 @@ namespace OpenSim.Region.Framework.Scenes
387 #endregion 425 #endregion
388 426
389 #region DUPLICATE OBJECT 427 #region DUPLICATE OBJECT
390 public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition) 428 public bool CanDuplicateObject(SceneObjectGroup sog, UUID agentID)
391 { 429 {
392 DuplicateObjectHandler handler = OnDuplicateObject; 430 DuplicateObjectHandler handler = OnDuplicateObject;
393 if (handler != null) 431 if (handler != null)
394 { 432 {
433 if(sog == null || sog.IsDeleted)
434 return false;
435 ScenePresence sp = m_scene.GetScenePresence(agentID);
436 if(sp == null || sp.IsDeleted)
437 return false;
395 Delegate[] list = handler.GetInvocationList(); 438 Delegate[] list = handler.GetInvocationList();
396 foreach (DuplicateObjectHandler h in list) 439 foreach (DuplicateObjectHandler h in list)
397 { 440 {
398 if (h(objectCount, objectID, owner, m_scene, objectPosition) == false) 441 if (h(sog, sp) == false)
399 return false; 442 return false;
400 } 443 }
401 } 444 }
@@ -411,9 +454,9 @@ namespace OpenSim.Region.Framework.Scenes
411 PrimFlags.ObjectOwnerModify 454 PrimFlags.ObjectOwnerModify
412 ); 455 );
413 456
414 public bool CanChangeSelectedState(UUID objectID, ScenePresence sp) 457 public bool CanChangeSelectedState(SceneObjectPart part, ScenePresence sp)
415 { 458 {
416 uint perms = GenerateClientFlags(sp , objectID); 459 uint perms = GenerateClientFlags(part, sp);
417 return (perms & CANSELECTMASK) != 0; 460 return (perms & CANSELECTMASK) != 0;
418 } 461 }
419 462
@@ -421,13 +464,33 @@ namespace OpenSim.Region.Framework.Scenes
421 #region EDIT OBJECT 464 #region EDIT OBJECT
422 public bool CanEditObject(UUID objectID, UUID editorID) 465 public bool CanEditObject(UUID objectID, UUID editorID)
423 { 466 {
467 EditObjectByIDsHandler handler = OnEditObjectByIDs;
468 if (handler != null)
469 {
470 Delegate[] list = handler.GetInvocationList();
471 foreach (EditObjectByIDsHandler h in list)
472 {
473 if (h(objectID, editorID) == false)
474 return false;
475 }
476 }
477 return true;
478 }
479
480 public bool CanEditObject(SceneObjectGroup sog, IClientAPI client)
481 {
424 EditObjectHandler handler = OnEditObject; 482 EditObjectHandler handler = OnEditObject;
425 if (handler != null) 483 if (handler != null)
426 { 484 {
485 if(sog == null || client == null || client.SceneAgent == null)
486 return false;
487
488 ScenePresence sp = client.SceneAgent as ScenePresence;
489
427 Delegate[] list = handler.GetInvocationList(); 490 Delegate[] list = handler.GetInvocationList();
428 foreach (EditObjectHandler h in list) 491 foreach (EditObjectHandler h in list)
429 { 492 {
430 if (h(objectID, editorID, m_scene) == false) 493 if (h(sog, sp) == false)
431 return false; 494 return false;
432 } 495 }
433 } 496 }
@@ -442,7 +505,7 @@ namespace OpenSim.Region.Framework.Scenes
442 Delegate[] list = handler.GetInvocationList(); 505 Delegate[] list = handler.GetInvocationList();
443 foreach (EditObjectInventoryHandler h in list) 506 foreach (EditObjectInventoryHandler h in list)
444 { 507 {
445 if (h(objectID, editorID, m_scene) == false) 508 if (h(objectID, editorID) == false)
446 return false; 509 return false;
447 } 510 }
448 } 511 }
@@ -452,15 +515,20 @@ namespace OpenSim.Region.Framework.Scenes
452 #endregion 515 #endregion
453 516
454 #region MOVE OBJECT 517 #region MOVE OBJECT
455 public bool CanMoveObject(UUID objectID, UUID moverID) 518 public bool CanMoveObject(SceneObjectGroup sog, IClientAPI client)
456 { 519 {
457 MoveObjectHandler handler = OnMoveObject; 520 MoveObjectHandler handler = OnMoveObject;
458 if (handler != null) 521 if (handler != null)
459 { 522 {
523 if(sog == null || client == null || client.SceneAgent == null)
524 return false;
525
526 ScenePresence sp = client.SceneAgent as ScenePresence;
527
460 Delegate[] list = handler.GetInvocationList(); 528 Delegate[] list = handler.GetInvocationList();
461 foreach (MoveObjectHandler h in list) 529 foreach (MoveObjectHandler h in list)
462 { 530 {
463 if (h(objectID, moverID, m_scene) == false) 531 if (h(sog, sp) == false)
464 return false; 532 return false;
465 } 533 }
466 } 534 }
@@ -470,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes
470 #endregion 538 #endregion
471 539
472 #region OBJECT ENTRY 540 #region OBJECT ENTRY
473 public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint) 541 public bool CanObjectEntry(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint)
474 { 542 {
475 ObjectEntryHandler handler = OnObjectEntry; 543 ObjectEntryHandler handler = OnObjectEntry;
476 if (handler != null) 544 if (handler != null)
@@ -478,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes
478 Delegate[] list = handler.GetInvocationList(); 546 Delegate[] list = handler.GetInvocationList();
479 foreach (ObjectEntryHandler h in list) 547 foreach (ObjectEntryHandler h in list)
480 { 548 {
481 if (h(objectID, enteringRegion, newPoint, m_scene) == false) 549 if (h(sog, enteringRegion, newPoint) == false)
482 return false; 550 return false;
483 } 551 }
484 } 552 }
@@ -488,17 +556,24 @@ namespace OpenSim.Region.Framework.Scenes
488 #endregion 556 #endregion
489 557
490 #region RETURN OBJECT 558 #region RETURN OBJECT
491 public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) 559 public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
492 { 560 {
493 bool result = true; 561 bool result = true;
494 562
495 ReturnObjectsHandler handler = OnReturnObjects; 563 ReturnObjectsHandler handler = OnReturnObjects;
496 if (handler != null) 564 if (handler != null)
497 { 565 {
566 if(objects == null)
567 return false;
568
569 ScenePresence sp = null;
570 if(client != null && client.SceneAgent != null)
571 sp = client.SceneAgent as ScenePresence;
572
498 Delegate[] list = handler.GetInvocationList(); 573 Delegate[] list = handler.GetInvocationList();
499 foreach (ReturnObjectsHandler h in list) 574 foreach (ReturnObjectsHandler h in list)
500 { 575 {
501 if (h(land, user, objects, m_scene) == false) 576 if (h(land, sp, objects) == false)
502 { 577 {
503 result = false; 578 result = false;
504 break; 579 break;
@@ -524,7 +599,7 @@ namespace OpenSim.Region.Framework.Scenes
524 Delegate[] list = handler.GetInvocationList(); 599 Delegate[] list = handler.GetInvocationList();
525 foreach (InstantMessageHandler h in list) 600 foreach (InstantMessageHandler h in list)
526 { 601 {
527 if (h(user, target, m_scene) == false) 602 if (h(user, target) == false)
528 return false; 603 return false;
529 } 604 }
530 } 605 }
@@ -542,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes
542 Delegate[] list = handler.GetInvocationList(); 617 Delegate[] list = handler.GetInvocationList();
543 foreach (InventoryTransferHandler h in list) 618 foreach (InventoryTransferHandler h in list)
544 { 619 {
545 if (h(user, target, m_scene) == false) 620 if (h(user, target) == false)
546 return false; 621 return false;
547 } 622 }
548 } 623 }
@@ -560,7 +635,7 @@ namespace OpenSim.Region.Framework.Scenes
560 Delegate[] list = handler.GetInvocationList(); 635 Delegate[] list = handler.GetInvocationList();
561 foreach (ViewScriptHandler h in list) 636 foreach (ViewScriptHandler h in list)
562 { 637 {
563 if (h(script, objectID, user, m_scene) == false) 638 if (h(script, objectID, user) == false)
564 return false; 639 return false;
565 } 640 }
566 } 641 }
@@ -575,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes
575 Delegate[] list = handler.GetInvocationList(); 650 Delegate[] list = handler.GetInvocationList();
576 foreach (ViewNotecardHandler h in list) 651 foreach (ViewNotecardHandler h in list)
577 { 652 {
578 if (h(script, objectID, user, m_scene) == false) 653 if (h(script, objectID, user) == false)
579 return false; 654 return false;
580 } 655 }
581 } 656 }
@@ -593,7 +668,7 @@ namespace OpenSim.Region.Framework.Scenes
593 Delegate[] list = handler.GetInvocationList(); 668 Delegate[] list = handler.GetInvocationList();
594 foreach (EditScriptHandler h in list) 669 foreach (EditScriptHandler h in list)
595 { 670 {
596 if (h(script, objectID, user, m_scene) == false) 671 if (h(script, objectID, user) == false)
597 return false; 672 return false;
598 } 673 }
599 } 674 }
@@ -608,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes
608 Delegate[] list = handler.GetInvocationList(); 683 Delegate[] list = handler.GetInvocationList();
609 foreach (EditNotecardHandler h in list) 684 foreach (EditNotecardHandler h in list)
610 { 685 {
611 if (h(script, objectID, user, m_scene) == false) 686 if (h(script, objectID, user) == false)
612 return false; 687 return false;
613 } 688 }
614 } 689 }
@@ -620,19 +695,37 @@ namespace OpenSim.Region.Framework.Scenes
620 #region RUN SCRIPT (When Script Placed in Object) 695 #region RUN SCRIPT (When Script Placed in Object)
621 public bool CanRunScript(UUID script, UUID objectID, UUID user) 696 public bool CanRunScript(UUID script, UUID objectID, UUID user)
622 { 697 {
698 RunScriptHandlerByIDs handler = OnRunScriptByIDs;
699 if (handler != null)
700 {
701 Delegate[] list = handler.GetInvocationList();
702 foreach (RunScriptHandlerByIDs h in list)
703 {
704 if (h(script, objectID, user) == false)
705 return false;
706 }
707 }
708 return true;
709 }
710
711 public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part)
712 {
623 RunScriptHandler handler = OnRunScript; 713 RunScriptHandler handler = OnRunScript;
624 if (handler != null) 714 if (handler != null)
625 { 715 {
716 if(item == null || part == null)
717 return false;
626 Delegate[] list = handler.GetInvocationList(); 718 Delegate[] list = handler.GetInvocationList();
627 foreach (RunScriptHandler h in list) 719 foreach (RunScriptHandler h in list)
628 { 720 {
629 if (h(script, objectID, user, m_scene) == false) 721 if (h(item, part) == false)
630 return false; 722 return false;
631 } 723 }
632 } 724 }
633 return true; 725 return true;
634 } 726 }
635 727
728
636 #endregion 729 #endregion
637 730
638 #region COMPILE SCRIPT (When Script needs to get (re)compiled) 731 #region COMPILE SCRIPT (When Script needs to get (re)compiled)
@@ -644,7 +737,7 @@ namespace OpenSim.Region.Framework.Scenes
644 Delegate[] list = handler.GetInvocationList(); 737 Delegate[] list = handler.GetInvocationList();
645 foreach (CompileScriptHandler h in list) 738 foreach (CompileScriptHandler h in list)
646 { 739 {
647 if (h(ownerUUID, scriptType, m_scene) == false) 740 if (h(ownerUUID, scriptType) == false)
648 return false; 741 return false;
649 } 742 }
650 } 743 }
@@ -662,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes
662 Delegate[] list = handler.GetInvocationList(); 755 Delegate[] list = handler.GetInvocationList();
663 foreach (StartScriptHandler h in list) 756 foreach (StartScriptHandler h in list)
664 { 757 {
665 if (h(script, user, m_scene) == false) 758 if (h(script, user) == false)
666 return false; 759 return false;
667 } 760 }
668 } 761 }
@@ -680,7 +773,7 @@ namespace OpenSim.Region.Framework.Scenes
680 Delegate[] list = handler.GetInvocationList(); 773 Delegate[] list = handler.GetInvocationList();
681 foreach (StopScriptHandler h in list) 774 foreach (StopScriptHandler h in list)
682 { 775 {
683 if (h(script, user, m_scene) == false) 776 if (h(script, user) == false)
684 return false; 777 return false;
685 } 778 }
686 } 779 }
@@ -698,7 +791,7 @@ namespace OpenSim.Region.Framework.Scenes
698 Delegate[] list = handler.GetInvocationList(); 791 Delegate[] list = handler.GetInvocationList();
699 foreach (ResetScriptHandler h in list) 792 foreach (ResetScriptHandler h in list)
700 { 793 {
701 if (h(prim, script, user, m_scene) == false) 794 if (h(prim, script, user) == false)
702 return false; 795 return false;
703 } 796 }
704 } 797 }
@@ -716,7 +809,7 @@ namespace OpenSim.Region.Framework.Scenes
716 Delegate[] list = handler.GetInvocationList(); 809 Delegate[] list = handler.GetInvocationList();
717 foreach (TerraformLandHandler h in list) 810 foreach (TerraformLandHandler h in list)
718 { 811 {
719 if (h(user, pos, m_scene) == false) 812 if (h(user, pos) == false)
720 return false; 813 return false;
721 } 814 }
722 } 815 }
@@ -734,7 +827,7 @@ namespace OpenSim.Region.Framework.Scenes
734 Delegate[] list = handler.GetInvocationList(); 827 Delegate[] list = handler.GetInvocationList();
735 foreach (RunConsoleCommandHandler h in list) 828 foreach (RunConsoleCommandHandler h in list)
736 { 829 {
737 if (h(user, m_scene) == false) 830 if (h(user) == false)
738 return false; 831 return false;
739 } 832 }
740 } 833 }
@@ -752,7 +845,7 @@ namespace OpenSim.Region.Framework.Scenes
752 Delegate[] list = handler.GetInvocationList(); 845 Delegate[] list = handler.GetInvocationList();
753 foreach (IssueEstateCommandHandler h in list) 846 foreach (IssueEstateCommandHandler h in list)
754 { 847 {
755 if (h(user, m_scene, ownerCommand) == false) 848 if (h(user, ownerCommand) == false)
756 return false; 849 return false;
757 } 850 }
758 } 851 }
@@ -763,13 +856,13 @@ namespace OpenSim.Region.Framework.Scenes
763 #region CAN BE GODLIKE 856 #region CAN BE GODLIKE
764 public bool IsGod(UUID user) 857 public bool IsGod(UUID user)
765 { 858 {
766 IsGodHandler handler = OnIsGod; 859 IsAdministratorHandler handler = OnIsAdministrator;
767 if (handler != null) 860 if (handler != null)
768 { 861 {
769 Delegate[] list = handler.GetInvocationList(); 862 Delegate[] list = handler.GetInvocationList();
770 foreach (IsGodHandler h in list) 863 foreach (IsAdministratorHandler h in list)
771 { 864 {
772 if (h(user, m_scene) == false) 865 if (h(user) == false)
773 return false; 866 return false;
774 } 867 }
775 } 868 }
@@ -784,7 +877,7 @@ namespace OpenSim.Region.Framework.Scenes
784 Delegate[] list = handler.GetInvocationList(); 877 Delegate[] list = handler.GetInvocationList();
785 foreach (IsGridGodHandler h in list) 878 foreach (IsGridGodHandler h in list)
786 { 879 {
787 if (h(user, m_scene) == false) 880 if (h(user) == false)
788 return false; 881 return false;
789 } 882 }
790 } 883 }
@@ -832,7 +925,7 @@ namespace OpenSim.Region.Framework.Scenes
832 Delegate[] list = handler.GetInvocationList(); 925 Delegate[] list = handler.GetInvocationList();
833 foreach (EditParcelPropertiesHandler h in list) 926 foreach (EditParcelPropertiesHandler h in list)
834 { 927 {
835 if (h(user, parcel, p, m_scene, allowManager) == false) 928 if (h(user, parcel, p, allowManager) == false)
836 return false; 929 return false;
837 } 930 }
838 } 931 }
@@ -849,7 +942,7 @@ namespace OpenSim.Region.Framework.Scenes
849 Delegate[] list = handler.GetInvocationList(); 942 Delegate[] list = handler.GetInvocationList();
850 foreach (SellParcelHandler h in list) 943 foreach (SellParcelHandler h in list)
851 { 944 {
852 if (h(user, parcel, m_scene) == false) 945 if (h(user, parcel) == false)
853 return false; 946 return false;
854 } 947 }
855 } 948 }
@@ -866,7 +959,7 @@ namespace OpenSim.Region.Framework.Scenes
866 Delegate[] list = handler.GetInvocationList(); 959 Delegate[] list = handler.GetInvocationList();
867 foreach (AbandonParcelHandler h in list) 960 foreach (AbandonParcelHandler h in list)
868 { 961 {
869 if (h(user, parcel, m_scene) == false) 962 if (h(user, parcel) == false)
870 return false; 963 return false;
871 } 964 }
872 } 965 }
@@ -882,7 +975,7 @@ namespace OpenSim.Region.Framework.Scenes
882 Delegate[] list = handler.GetInvocationList(); 975 Delegate[] list = handler.GetInvocationList();
883 foreach (ReclaimParcelHandler h in list) 976 foreach (ReclaimParcelHandler h in list)
884 { 977 {
885 if (h(user, parcel, m_scene) == false) 978 if (h(user, parcel) == false)
886 return false; 979 return false;
887 } 980 }
888 } 981 }
@@ -897,22 +990,27 @@ namespace OpenSim.Region.Framework.Scenes
897 Delegate[] list = handler.GetInvocationList(); 990 Delegate[] list = handler.GetInvocationList();
898 foreach (DeedParcelHandler h in list) 991 foreach (DeedParcelHandler h in list)
899 { 992 {
900 if (h(user, parcel, m_scene) == false) 993 if (h(user, parcel) == false)
901 return false; 994 return false;
902 } 995 }
903 } 996 }
904 return true; 997 return true;
905 } 998 }
906 999
907 public bool CanDeedObject(UUID user, UUID group) 1000 public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
908 { 1001 {
909 DeedObjectHandler handler = OnDeedObject; 1002 DeedObjectHandler handler = OnDeedObject;
910 if (handler != null) 1003 if (handler != null)
911 { 1004 {
1005 if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
1006 return false;
1007
1008 ScenePresence sp = client.SceneAgent as ScenePresence;
1009
912 Delegate[] list = handler.GetInvocationList(); 1010 Delegate[] list = handler.GetInvocationList();
913 foreach (DeedObjectHandler h in list) 1011 foreach (DeedObjectHandler h in list)
914 { 1012 {
915 if (h(user, group, m_scene) == false) 1013 if (h(sp, sog, targetGroupID) == false)
916 return false; 1014 return false;
917 } 1015 }
918 } 1016 }
@@ -927,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes
927 Delegate[] list = handler.GetInvocationList(); 1025 Delegate[] list = handler.GetInvocationList();
928 foreach (BuyLandHandler h in list) 1026 foreach (BuyLandHandler h in list)
929 { 1027 {
930 if (h(user, parcel, m_scene) == false) 1028 if (h(user, parcel) == false)
931 return false; 1029 return false;
932 } 1030 }
933 } 1031 }
@@ -1003,6 +1101,45 @@ namespace OpenSim.Region.Framework.Scenes
1003 return true; 1101 return true;
1004 } 1102 }
1005 1103
1104 public bool CanDoObjectInvToObjectInv(TaskInventoryItem item, SceneObjectPart sourcePart, SceneObjectPart destPart)
1105 {
1106 DoObjectInvToObjectInv handler = OnDoObjectInvToObjectInv;
1107 if (handler != null)
1108 {
1109 if (sourcePart == null || destPart == null || item == null)
1110 return false;
1111 Delegate[] list = handler.GetInvocationList();
1112 foreach (DoObjectInvToObjectInv h in list)
1113 {
1114 if (h(item, sourcePart, destPart) == false)
1115 return false;
1116 }
1117 }
1118 return true;
1119 }
1120
1121 public bool CanDropInObjectInv(InventoryItemBase item, IClientAPI client, SceneObjectPart destPart)
1122 {
1123 DoDropInObjectInv handler = OnDropInObjectInv;
1124 if (handler != null)
1125 {
1126 if (client == null || client.SceneAgent == null|| destPart == null || item == null)
1127 return false;
1128
1129 ScenePresence sp = client.SceneAgent as ScenePresence;
1130 if(sp == null || sp.IsDeleted)
1131 return false;
1132
1133 Delegate[] list = handler.GetInvocationList();
1134 foreach (DoDropInObjectInv h in list)
1135 {
1136 if (h(item, sp, destPart) == false)
1137 return false;
1138 }
1139 }
1140 return true;
1141 }
1142
1006 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID) 1143 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
1007 { 1144 {
1008 DeleteObjectInventoryHandler handler = OnDeleteObjectInventory; 1145 DeleteObjectInventoryHandler handler = OnDeleteObjectInventory;