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.cs106
1 files changed, 56 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 6d3b82f..7d69a9b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes
47 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient); 47 public delegate bool TransferObjectHandler(UUID objectID, UUID recipient);
48 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp); 48 public delegate bool TakeObjectHandler(SceneObjectGroup sog, ScenePresence sp);
49 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID); 49 public delegate bool SellGroupObjectHandler(UUID userID, UUID groupID);
50 public delegate bool SellObjectHandlerByUserID(SceneObjectGroup sog, UUID userID, byte saleType);
51 public delegate bool SellObjectHandler(SceneObjectGroup sog, ScenePresence sp, byte saleType);
50 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp); 52 public delegate bool TakeCopyObjectHandler(SceneObjectGroup sog, ScenePresence sp);
51 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp); 53 public delegate bool DuplicateObjectHandler(SceneObjectGroup sog, ScenePresence sp);
52 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID); 54 public delegate bool EditObjectByIDsHandler(UUID objectID, UUID editorID);
@@ -121,7 +123,11 @@ namespace OpenSim.Region.Framework.Scenes
121 public event DeleteObjectHandler OnDeleteObject; 123 public event DeleteObjectHandler OnDeleteObject;
122 public event TransferObjectHandler OnTransferObject; 124 public event TransferObjectHandler OnTransferObject;
123 public event TakeObjectHandler OnTakeObject; 125 public event TakeObjectHandler OnTakeObject;
126
124 public event SellGroupObjectHandler OnSellGroupObject; 127 public event SellGroupObjectHandler OnSellGroupObject;
128 public event SellObjectHandlerByUserID OnSellObjectByUserID;
129 public event SellObjectHandler OnSellObject;
130
125 public event TakeCopyObjectHandler OnTakeCopyObject; 131 public event TakeCopyObjectHandler OnTakeCopyObject;
126 public event DuplicateObjectHandler OnDuplicateObject; 132 public event DuplicateObjectHandler OnDuplicateObject;
127 public event EditObjectByIDsHandler OnEditObjectByIDs; 133 public event EditObjectByIDsHandler OnEditObjectByIDs;
@@ -281,14 +287,11 @@ namespace OpenSim.Region.Framework.Scenes
281 } 287 }
282 } 288 }
283 } 289 }
284
285 return result; 290 return result;
286 } 291 }
287 292
288 public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client) 293 public bool CanDeleteObject(SceneObjectGroup sog, IClientAPI client)
289 { 294 {
290 bool result = true;
291
292 DeleteObjectHandler handler = OnDeleteObject; 295 DeleteObjectHandler handler = OnDeleteObject;
293 if (handler != null) 296 if (handler != null)
294 { 297 {
@@ -301,20 +304,15 @@ namespace OpenSim.Region.Framework.Scenes
301 foreach (DeleteObjectHandler h in list) 304 foreach (DeleteObjectHandler h in list)
302 { 305 {
303 if (h(sog, sp) == false) 306 if (h(sog, sp) == false)
304 { 307 return false;
305 result = false;
306 break;
307 }
308 } 308 }
309 } 309 }
310 310
311 return result; 311 return true;
312 } 312 }
313 313
314 public bool CanTransferObject(UUID objectID, UUID recipient) 314 public bool CanTransferObject(UUID objectID, UUID recipient)
315 { 315 {
316 bool result = true;
317
318 TransferObjectHandler handler = OnTransferObject; 316 TransferObjectHandler handler = OnTransferObject;
319 if (handler != null) 317 if (handler != null)
320 { 318 {
@@ -322,14 +320,10 @@ namespace OpenSim.Region.Framework.Scenes
322 foreach (TransferObjectHandler h in list) 320 foreach (TransferObjectHandler h in list)
323 { 321 {
324 if (h(objectID, recipient) == false) 322 if (h(objectID, recipient) == false)
325 { 323 return false;
326 result = false;
327 break;
328 }
329 } 324 }
330 } 325 }
331 326 return true;
332 return result;
333 } 327 }
334 328
335 #endregion 329 #endregion
@@ -337,8 +331,6 @@ namespace OpenSim.Region.Framework.Scenes
337 #region TAKE OBJECT 331 #region TAKE OBJECT
338 public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp) 332 public bool CanTakeObject(SceneObjectGroup sog, ScenePresence sp)
339 { 333 {
340 bool result = true;
341
342 TakeObjectHandler handler = OnTakeObject; 334 TakeObjectHandler handler = OnTakeObject;
343 if (handler != null) 335 if (handler != null)
344 { 336 {
@@ -349,18 +341,13 @@ namespace OpenSim.Region.Framework.Scenes
349 foreach (TakeObjectHandler h in list) 341 foreach (TakeObjectHandler h in list)
350 { 342 {
351 if (h(sog, sp) == false) 343 if (h(sog, sp) == false)
352 { 344 return false;
353 result = false;
354 break;
355 }
356 } 345 }
357 } 346 }
358
359// m_log.DebugFormat( 347// m_log.DebugFormat(
360// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", 348// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}",
361// objectID, AvatarTakingUUID, result); 349// objectID, AvatarTakingUUID, result);
362 350 return true;
363 return result;
364 } 351 }
365 352
366 #endregion 353 #endregion
@@ -368,8 +355,6 @@ namespace OpenSim.Region.Framework.Scenes
368 #region SELL GROUP OBJECT 355 #region SELL GROUP OBJECT
369 public bool CanSellGroupObject(UUID userID, UUID groupID) 356 public bool CanSellGroupObject(UUID userID, UUID groupID)
370 { 357 {
371 bool result = true;
372
373 SellGroupObjectHandler handler = OnSellGroupObject; 358 SellGroupObjectHandler handler = OnSellGroupObject;
374 if (handler != null) 359 if (handler != null)
375 { 360 {
@@ -377,18 +362,52 @@ namespace OpenSim.Region.Framework.Scenes
377 foreach (SellGroupObjectHandler h in list) 362 foreach (SellGroupObjectHandler h in list)
378 { 363 {
379 if (h(userID, groupID) == false) 364 if (h(userID, groupID) == false)
380 { 365 return false;
381 result = false;
382 break;
383 }
384 } 366 }
385 } 367 }
386
387 //m_log.DebugFormat( 368 //m_log.DebugFormat(
388 // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}", 369 // "[SCENE PERMISSIONS]: CanSellGroupObject() fired for user {0}, group {1}, result {2}",
389 // userID, groupID, result); 370 // userID, groupID, result);
371 return true;
372 }
390 373
391 return result; 374 #endregion
375
376 #region SELL OBJECT
377 public bool CanSellObject(IClientAPI client, SceneObjectGroup sog, byte saleType)
378 {
379 SellObjectHandler handler = OnSellObject;
380 if (handler != null)
381 {
382 if(sog == null || client == null || client.SceneAgent == null)
383 return false;
384
385 ScenePresence sp = client.SceneAgent as ScenePresence;
386 Delegate[] list = handler.GetInvocationList();
387 foreach (SellObjectHandler h in list)
388 {
389 if (h(sog, sp, saleType) == false)
390 return false;
391 }
392 }
393 return true;
394 }
395
396 public bool CanSellObject(UUID userID, SceneObjectGroup sog, byte saleType)
397 {
398 SellObjectHandlerByUserID handler = OnSellObjectByUserID;
399 if (handler != null)
400 {
401 if(sog == null)
402 return false;
403 Delegate[] list = handler.GetInvocationList();
404 foreach (SellObjectHandlerByUserID h in list)
405 {
406 if (h(sog, userID, saleType) == false)
407 return false;
408 }
409 }
410 return true;
392 } 411 }
393 412
394 #endregion 413 #endregion
@@ -397,8 +416,6 @@ namespace OpenSim.Region.Framework.Scenes
397 #region TAKE COPY OBJECT 416 #region TAKE COPY OBJECT
398 public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp) 417 public bool CanTakeCopyObject(SceneObjectGroup sog, ScenePresence sp)
399 { 418 {
400 bool result = true;
401
402 TakeCopyObjectHandler handler = OnTakeCopyObject; 419 TakeCopyObjectHandler handler = OnTakeCopyObject;
403 if (handler != null) 420 if (handler != null)
404 { 421 {
@@ -408,18 +425,13 @@ namespace OpenSim.Region.Framework.Scenes
408 foreach (TakeCopyObjectHandler h in list) 425 foreach (TakeCopyObjectHandler h in list)
409 { 426 {
410 if (h(sog, sp) == false) 427 if (h(sog, sp) == false)
411 { 428 return false;
412 result = false;
413 break;
414 }
415 } 429 }
416 } 430 }
417
418// m_log.DebugFormat( 431// m_log.DebugFormat(
419// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", 432// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}",
420// objectID, userID, result); 433// objectID, userID, result);
421 434 return true;
422 return result;
423 } 435 }
424 436
425 #endregion 437 #endregion
@@ -558,8 +570,6 @@ namespace OpenSim.Region.Framework.Scenes
558 #region RETURN OBJECT 570 #region RETURN OBJECT
559 public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects) 571 public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
560 { 572 {
561 bool result = true;
562
563 ReturnObjectsHandler handler = OnReturnObjects; 573 ReturnObjectsHandler handler = OnReturnObjects;
564 if (handler != null) 574 if (handler != null)
565 { 575 {
@@ -574,18 +584,14 @@ namespace OpenSim.Region.Framework.Scenes
574 foreach (ReturnObjectsHandler h in list) 584 foreach (ReturnObjectsHandler h in list)
575 { 585 {
576 if (h(land, sp, objects) == false) 586 if (h(land, sp, objects) == false)
577 { 587 return false;
578 result = false;
579 break;
580 }
581 } 588 }
582 } 589 }
583
584// m_log.DebugFormat( 590// m_log.DebugFormat(
585// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", 591// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}",
586// user, objects.Count, land.LandData.Name, result); 592// user, objects.Count, land.LandData.Name, result);
587 593
588 return result; 594 return true;
589 } 595 }
590 596
591 #endregion 597 #endregion