aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Permissions.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Permissions.cs1334
1 files changed, 0 insertions, 1334 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs b/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs
deleted file mode 100644
index 0872128..0000000
--- a/OpenSim/Region/Environment/Scenes/Scene.Permissions.cs
+++ /dev/null
@@ -1,1334 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Text;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces;
34
35namespace OpenSim.Region.Environment.Scenes
36{
37 public class ScenePermissions
38 {
39 private Scene m_scene;
40
41 public ScenePermissions(Scene scene)
42 {
43 m_scene = scene;
44 }
45
46 #region Object Permission Checks
47
48 public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectIDID);
49 private List<GenerateClientFlagsHandler> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlagsHandler>();
50
51 public void AddGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc)
52 {
53 if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
54 GenerateClientFlagsCheckFunctions.Add(delegateFunc);
55 }
56
57 public void RemoveGenerateClientFlagsHandler(GenerateClientFlagsHandler delegateFunc)
58 {
59 if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
60 GenerateClientFlagsCheckFunctions.Remove(delegateFunc);
61 }
62
63 public uint GenerateClientFlags(UUID userID, UUID objectID)
64 {
65 SceneObjectPart part=m_scene.GetSceneObjectPart(objectID);
66
67 if (part == null)
68 return 0;
69
70 // libomv will moan about PrimFlags.ObjectYouOfficer being
71 // obsolete...
72 #pragma warning disable 0612
73 uint perms=part.GetEffectiveObjectFlags() |
74 (uint)PrimFlags.ObjectModify |
75 (uint)PrimFlags.ObjectCopy |
76 (uint)PrimFlags.ObjectMove |
77 (uint)PrimFlags.ObjectTransfer |
78 (uint)PrimFlags.ObjectYouOwner |
79 (uint)PrimFlags.ObjectAnyOwner |
80 (uint)PrimFlags.ObjectOwnerModify |
81 (uint)PrimFlags.ObjectYouOfficer;
82 #pragma warning restore 0612
83
84 foreach (GenerateClientFlagsHandler check in GenerateClientFlagsCheckFunctions)
85 {
86 perms &= check(userID, objectID);
87 }
88 return perms;
89 }
90
91 public delegate void SetBypassPermissionsHandler(bool value);
92 private List<SetBypassPermissionsHandler> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissionsHandler>();
93
94 public void AddSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
95 {
96 if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
97 SetBypassPermissionsCheckFunctions.Add(delegateFunc);
98 }
99
100 public void RemoveSetBypassPermissionsHandler(SetBypassPermissionsHandler delegateFunc)
101 {
102 if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
103 SetBypassPermissionsCheckFunctions.Remove(delegateFunc);
104 }
105
106 public void SetBypassPermissions(bool value)
107 {
108 foreach (SetBypassPermissionsHandler check in SetBypassPermissionsCheckFunctions)
109 {
110 check(value);
111 }
112 }
113
114 public delegate bool BypassPermissionsHandler();
115 private List<BypassPermissionsHandler> BypassPermissionsCheckFunctions = new List<BypassPermissionsHandler>();
116
117 public void AddBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
118 {
119 if (!BypassPermissionsCheckFunctions.Contains(delegateFunc))
120 BypassPermissionsCheckFunctions.Add(delegateFunc);
121 }
122
123 public void RemoveBypassPermissionsHandler(BypassPermissionsHandler delegateFunc)
124 {
125 if (BypassPermissionsCheckFunctions.Contains(delegateFunc))
126 BypassPermissionsCheckFunctions.Remove(delegateFunc);
127 }
128
129 public bool BypassPermissions()
130 {
131 foreach (BypassPermissionsHandler check in BypassPermissionsCheckFunctions)
132 {
133 if (check() == false)
134 {
135 return false;
136 }
137 }
138 return true;
139 }
140
141 public delegate bool PropagatePermissionsHandler();
142 private List<PropagatePermissionsHandler> PropagatePermissionsCheckFunctions = new List<PropagatePermissionsHandler>();
143
144 public void AddPropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
145 {
146 if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
147 PropagatePermissionsCheckFunctions.Add(delegateFunc);
148 }
149
150 public void RemovePropagatePermissionsHandler(PropagatePermissionsHandler delegateFunc)
151 {
152 if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
153 PropagatePermissionsCheckFunctions.Remove(delegateFunc);
154 }
155
156 public bool PropagatePermissions()
157 {
158 foreach (PropagatePermissionsHandler check in PropagatePermissionsCheckFunctions)
159 {
160 if (check() == false)
161 {
162 return false;
163 }
164 }
165 return true;
166 }
167
168 #region REZ OBJECT
169 public delegate bool CanRezObjectHandler(int objectCount, UUID owner, Vector3 objectPosition, Scene scene);
170 private List<CanRezObjectHandler> CanRezObjectCheckFunctions = new List<CanRezObjectHandler>();
171
172 public void AddRezObjectHandler(CanRezObjectHandler delegateFunc)
173 {
174 if (!CanRezObjectCheckFunctions.Contains(delegateFunc))
175 CanRezObjectCheckFunctions.Add(delegateFunc);
176 }
177
178 public void RemoveRezObjectHandler(CanRezObjectHandler delegateFunc)
179 {
180 if (CanRezObjectCheckFunctions.Contains(delegateFunc))
181 CanRezObjectCheckFunctions.Remove(delegateFunc);
182 }
183
184 public bool CanRezObject(int objectCount, UUID owner, Vector3 objectPosition)
185 {
186 foreach (CanRezObjectHandler check in CanRezObjectCheckFunctions)
187 {
188 if (check(objectCount, owner,objectPosition, m_scene) == false)
189 {
190 return false;
191 }
192 }
193 return true;
194 }
195
196 #endregion
197
198 #region DELETE OBJECT
199 public delegate bool CanDeleteObjectHandler(UUID objectID, UUID deleter, Scene scene);
200 private List<CanDeleteObjectHandler> CanDeleteObjectCheckFunctions = new List<CanDeleteObjectHandler>();
201
202 public void AddDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
203 {
204 if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
205 CanDeleteObjectCheckFunctions.Add(delegateFunc);
206 }
207
208 public void RemoveDeleteObjectHandler(CanDeleteObjectHandler delegateFunc)
209 {
210 if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
211 CanDeleteObjectCheckFunctions.Remove(delegateFunc);
212 }
213
214 public bool CanDeleteObject(UUID objectID, UUID deleter)
215 {
216 foreach (CanDeleteObjectHandler check in CanDeleteObjectCheckFunctions)
217 {
218 if (check(objectID,deleter,m_scene) == false)
219 {
220 return false;
221 }
222 }
223 return true;
224 }
225
226 #endregion
227
228 #region TAKE OBJECT
229 public delegate bool CanTakeObjectHandler(UUID objectID, UUID stealer, Scene scene);
230 private List<CanTakeObjectHandler> CanTakeObjectCheckFunctions = new List<CanTakeObjectHandler>();
231
232 public void AddTakeObjectHandler(CanTakeObjectHandler delegateFunc)
233 {
234 if (!CanTakeObjectCheckFunctions.Contains(delegateFunc))
235 CanTakeObjectCheckFunctions.Add(delegateFunc);
236 }
237
238 public void RemoveTakeObjectHandler(CanTakeObjectHandler delegateFunc)
239 {
240 if (CanTakeObjectCheckFunctions.Contains(delegateFunc))
241 CanTakeObjectCheckFunctions.Remove(delegateFunc);
242 }
243
244 public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
245 {
246 foreach (CanTakeObjectHandler check in CanTakeObjectCheckFunctions)
247 {
248 if (check(objectID, AvatarTakingUUID, m_scene) == false)
249 {
250 return false;
251 }
252 }
253 return true;
254 }
255
256 #endregion
257
258 #region TAKE COPY OBJECT
259 public delegate bool CanTakeCopyObjectHandler(UUID objectID, UUID userID, Scene inScene);
260 private List<CanTakeCopyObjectHandler> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObjectHandler>();
261
262 public void AddTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
263 {
264 if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
265 CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
266 }
267
268 public void RemoveTakeCopyObjectHandler(CanTakeCopyObjectHandler delegateFunc)
269 {
270 if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
271 CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
272 }
273
274 public bool CanTakeCopyObject(UUID objectID, UUID userID)
275 {
276 foreach (CanTakeCopyObjectHandler check in CanTakeCopyObjectCheckFunctions)
277 {
278 if (check(objectID,userID,m_scene) == false)
279 {
280 return false;
281 }
282 }
283 return true;
284 }
285
286 #endregion
287
288 #region DUPLICATE OBJECT
289 public delegate bool CanDuplicateObjectHandler(int objectCount, UUID objectID, UUID owner, Scene scene, Vector3 objectPosition);
290 private List<CanDuplicateObjectHandler> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObjectHandler>();
291
292 public void AddDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
293 {
294 if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
295 CanDuplicateObjectCheckFunctions.Add(delegateFunc);
296 }
297
298 public void RemoveDuplicateObjectHandler(CanDuplicateObjectHandler delegateFunc)
299 {
300 if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
301 CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
302 }
303
304 public bool CanDuplicateObject(int objectCount, UUID objectID, UUID owner, Vector3 objectPosition)
305 {
306 foreach (CanDuplicateObjectHandler check in CanDuplicateObjectCheckFunctions)
307 {
308 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
309 {
310 return false;
311 }
312 }
313 return true;
314 }
315
316 #endregion
317
318 #region EDIT OBJECT
319 public delegate bool CanEditObjectHandler(UUID objectID, UUID editorID, Scene scene);
320 private List<CanEditObjectHandler> CanEditObjectCheckFunctions = new List<CanEditObjectHandler>();
321
322 public void AddEditObjectHandler(CanEditObjectHandler delegateFunc)
323 {
324 if (!CanEditObjectCheckFunctions.Contains(delegateFunc))
325 CanEditObjectCheckFunctions.Add(delegateFunc);
326 }
327
328 public void RemoveEditObjectHandler(CanEditObjectHandler delegateFunc)
329 {
330 if (CanEditObjectCheckFunctions.Contains(delegateFunc))
331 CanEditObjectCheckFunctions.Remove(delegateFunc);
332 }
333
334 public bool CanEditObject(UUID objectID, UUID editorID)
335 {
336 foreach (CanEditObjectHandler check in CanEditObjectCheckFunctions)
337 {
338 if (check(objectID, editorID, m_scene) == false)
339 {
340 return false;
341 }
342 }
343 return true;
344 }
345
346 public delegate bool CanEditObjectInventoryHandler(UUID objectID, UUID editorID, Scene scene);
347 private List<CanEditObjectInventoryHandler> CanEditObjectInventoryCheckFunctions = new List<CanEditObjectInventoryHandler>();
348
349 public void AddEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
350 {
351 if (!CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
352 CanEditObjectInventoryCheckFunctions.Add(delegateFunc);
353 }
354
355 public void RemoveEditObjectInventoryHandler(CanEditObjectInventoryHandler delegateFunc)
356 {
357 if (CanEditObjectInventoryCheckFunctions.Contains(delegateFunc))
358 CanEditObjectInventoryCheckFunctions.Remove(delegateFunc);
359 }
360
361 public bool CanEditObjectInventory(UUID objectID, UUID editorID)
362 {
363 foreach (CanEditObjectInventoryHandler check in CanEditObjectInventoryCheckFunctions)
364 {
365 if (check(objectID, editorID, m_scene) == false)
366 {
367 return false;
368 }
369 }
370 return true;
371 }
372
373 #endregion
374
375 #region MOVE OBJECT
376 public delegate bool CanMoveObjectHandler(UUID objectID, UUID moverID, Scene scene);
377 private List<CanMoveObjectHandler> CanMoveObjectCheckFunctions = new List<CanMoveObjectHandler>();
378
379 public void AddMoveObjectHandler(CanMoveObjectHandler delegateFunc)
380 {
381 if (!CanMoveObjectCheckFunctions.Contains(delegateFunc))
382 CanMoveObjectCheckFunctions.Add(delegateFunc);
383 }
384
385 public void RemoveMoveObjectHandler(CanMoveObjectHandler delegateFunc)
386 {
387 if (CanMoveObjectCheckFunctions.Contains(delegateFunc))
388 CanMoveObjectCheckFunctions.Remove(delegateFunc);
389 }
390
391 public bool CanMoveObject(UUID objectID, UUID moverID)
392 {
393 foreach (CanMoveObjectHandler check in CanMoveObjectCheckFunctions)
394 {
395 if (check(objectID,moverID,m_scene) == false)
396 {
397 return false;
398 }
399 }
400 return true;
401 }
402
403 #endregion
404
405 #region OBJECT ENTRY
406 public delegate bool CanObjectEntryHandler(UUID objectID, bool enteringRegion, Vector3 newPoint, Scene scene);
407 private List<CanObjectEntryHandler> CanObjectEntryCheckFunctions = new List<CanObjectEntryHandler>();
408
409 public void AddObjectEntryHandler(CanObjectEntryHandler delegateFunc)
410 {
411 if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
412 CanObjectEntryCheckFunctions.Add(delegateFunc);
413 }
414
415 public void RemoveObjectEntryHandler(CanObjectEntryHandler delegateFunc)
416 {
417 if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
418 CanObjectEntryCheckFunctions.Remove(delegateFunc);
419 }
420
421 public bool CanObjectEntry(UUID objectID, bool enteringRegion, Vector3 newPoint)
422 {
423 foreach (CanObjectEntryHandler check in CanObjectEntryCheckFunctions)
424 {
425 if (check(objectID, enteringRegion, newPoint, m_scene) == false)
426 {
427 return false;
428 }
429 }
430 return true;
431 }
432
433 #endregion
434
435 #region RETURN OBJECT
436 public delegate bool CanReturnObjectHandler(UUID objectID, UUID returnerID, Scene scene);
437 private List<CanReturnObjectHandler> CanReturnObjectCheckFunctions = new List<CanReturnObjectHandler>();
438
439 public void AddReturnObjectHandler(CanReturnObjectHandler delegateFunc)
440 {
441 if (!CanReturnObjectCheckFunctions.Contains(delegateFunc))
442 CanReturnObjectCheckFunctions.Add(delegateFunc);
443 }
444
445 public void RemoveReturnObjectHandler(CanReturnObjectHandler delegateFunc)
446 {
447 if (CanReturnObjectCheckFunctions.Contains(delegateFunc))
448 CanReturnObjectCheckFunctions.Remove(delegateFunc);
449 }
450
451 public bool CanReturnObject(UUID objectID, UUID returnerID)
452 {
453 foreach (CanReturnObjectHandler check in CanReturnObjectCheckFunctions)
454 {
455 if (check(objectID,returnerID,m_scene) == false)
456 {
457 return false;
458 }
459 }
460 return true;
461 }
462
463 #endregion
464
465 #region INSTANT MESSAGE
466 public delegate bool CanInstantMessageHandler(UUID user, UUID target, Scene startScene);
467 private List<CanInstantMessageHandler> CanInstantMessageCheckFunctions = new List<CanInstantMessageHandler>();
468
469 public void AddInstantMessageHandler(CanInstantMessageHandler delegateFunc)
470 {
471 if (!CanInstantMessageCheckFunctions.Contains(delegateFunc))
472 CanInstantMessageCheckFunctions.Add(delegateFunc);
473 }
474
475 public void RemoveInstantMessageHandler(CanInstantMessageHandler delegateFunc)
476 {
477 if (CanInstantMessageCheckFunctions.Contains(delegateFunc))
478 CanInstantMessageCheckFunctions.Remove(delegateFunc);
479 }
480
481 public bool CanInstantMessage(UUID user, UUID target)
482 {
483 foreach (CanInstantMessageHandler check in CanInstantMessageCheckFunctions)
484 {
485 if (check(user, target, m_scene) == false)
486 {
487 return false;
488 }
489 }
490 return true;
491 }
492
493 #endregion
494
495 #region INVENTORY TRANSFER
496 public delegate bool CanInventoryTransferHandler(UUID user, UUID target, Scene startScene);
497 private List<CanInventoryTransferHandler> CanInventoryTransferCheckFunctions = new List<CanInventoryTransferHandler>();
498
499 public void AddInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
500 {
501 if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc))
502 CanInventoryTransferCheckFunctions.Add(delegateFunc);
503 }
504
505 public void RemoveInventoryTransferHandler(CanInventoryTransferHandler delegateFunc)
506 {
507 if (CanInventoryTransferCheckFunctions.Contains(delegateFunc))
508 CanInventoryTransferCheckFunctions.Remove(delegateFunc);
509 }
510
511 public bool CanInventoryTransfer(UUID user, UUID target)
512 {
513 foreach (CanInventoryTransferHandler check in CanInventoryTransferCheckFunctions)
514 {
515 if (check(user, target, m_scene) == false)
516 {
517 return false;
518 }
519 }
520 return true;
521 }
522
523 #endregion
524
525 #region VIEW SCRIPT
526 public delegate bool CanViewScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
527 private List<CanViewScriptHandler> CanViewScriptCheckFunctions = new List<CanViewScriptHandler>();
528
529 public void AddViewScriptHandler(CanViewScriptHandler delegateFunc)
530 {
531 if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
532 CanViewScriptCheckFunctions.Add(delegateFunc);
533 }
534
535 public void RemoveViewScriptHandler(CanViewScriptHandler delegateFunc)
536 {
537 if (CanViewScriptCheckFunctions.Contains(delegateFunc))
538 CanViewScriptCheckFunctions.Remove(delegateFunc);
539 }
540
541 public bool CanViewScript(UUID script, UUID objectID, UUID user)
542 {
543 foreach (CanViewScriptHandler check in CanViewScriptCheckFunctions)
544 {
545 if (check(script, objectID, user, m_scene) == false)
546 {
547 return false;
548 }
549 }
550 return true;
551 }
552
553 public delegate bool CanViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene);
554 private List<CanViewNotecardHandler> CanViewNotecardCheckFunctions = new List<CanViewNotecardHandler>();
555
556 public void AddViewNotecardHandler(CanViewNotecardHandler delegateFunc)
557 {
558 if (!CanViewNotecardCheckFunctions.Contains(delegateFunc))
559 CanViewNotecardCheckFunctions.Add(delegateFunc);
560 }
561
562 public void RemoveViewNotecardHandler(CanViewNotecardHandler delegateFunc)
563 {
564 if (CanViewNotecardCheckFunctions.Contains(delegateFunc))
565 CanViewNotecardCheckFunctions.Remove(delegateFunc);
566 }
567
568 public bool CanViewNotecard(UUID script, UUID objectID, UUID user)
569 {
570 foreach (CanViewNotecardHandler check in CanViewNotecardCheckFunctions)
571 {
572 if (check(script, objectID, user, m_scene) == false)
573 {
574 return false;
575 }
576 }
577 return true;
578 }
579
580 #endregion
581
582 #region EDIT SCRIPT
583 public delegate bool CanEditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
584 private List<CanEditScriptHandler> CanEditScriptCheckFunctions = new List<CanEditScriptHandler>();
585
586 public void AddEditScriptHandler(CanEditScriptHandler delegateFunc)
587 {
588 if (!CanEditScriptCheckFunctions.Contains(delegateFunc))
589 CanEditScriptCheckFunctions.Add(delegateFunc);
590 }
591
592 public void RemoveEditScriptHandler(CanEditScriptHandler delegateFunc)
593 {
594 if (CanEditScriptCheckFunctions.Contains(delegateFunc))
595 CanEditScriptCheckFunctions.Remove(delegateFunc);
596 }
597
598 public bool CanEditScript(UUID script, UUID objectID, UUID user)
599 {
600 foreach (CanEditScriptHandler check in CanEditScriptCheckFunctions)
601 {
602 if (check(script, objectID, user, m_scene) == false)
603 {
604 return false;
605 }
606 }
607 return true;
608 }
609
610 public delegate bool CanEditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
611 private List<CanEditNotecardHandler> CanEditNotecardCheckFunctions = new List<CanEditNotecardHandler>();
612
613 public void AddEditNotecardHandler(CanEditNotecardHandler delegateFunc)
614 {
615 if (!CanEditNotecardCheckFunctions.Contains(delegateFunc))
616 CanEditNotecardCheckFunctions.Add(delegateFunc);
617 }
618
619 public void RemoveEditNotecardHandler(CanEditNotecardHandler delegateFunc)
620 {
621 if (CanEditNotecardCheckFunctions.Contains(delegateFunc))
622 CanEditNotecardCheckFunctions.Remove(delegateFunc);
623 }
624
625 public bool CanEditNotecard(UUID script, UUID objectID, UUID user)
626 {
627 foreach (CanEditNotecardHandler check in CanEditNotecardCheckFunctions)
628 {
629 if (check(script, objectID, user, m_scene) == false)
630 {
631 return false;
632 }
633 }
634 return true;
635 }
636
637 #endregion
638
639 #region RUN SCRIPT (When Script Placed in Object)
640 public delegate bool CanRunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
641 private List<CanRunScriptHandler> CanRunScriptCheckFunctions = new List<CanRunScriptHandler>();
642
643 public void AddRunScriptHandler(CanRunScriptHandler delegateFunc)
644 {
645 if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
646 CanRunScriptCheckFunctions.Add(delegateFunc);
647 }
648
649 public void RemoveRunScriptHandler(CanRunScriptHandler delegateFunc)
650 {
651 if (CanRunScriptCheckFunctions.Contains(delegateFunc))
652 CanRunScriptCheckFunctions.Remove(delegateFunc);
653 }
654
655 public bool CanRunScript(UUID script, UUID objectID, UUID user)
656 {
657 foreach (CanRunScriptHandler check in CanRunScriptCheckFunctions)
658 {
659 if (check(script, objectID, user, m_scene) == false)
660 {
661 return false;
662 }
663 }
664 return true;
665 }
666
667 #endregion
668
669 #region START SCRIPT (When Script run box is Checked after placed in object)
670 public delegate bool CanStartScriptHandler(UUID script, UUID user, Scene scene);
671 private List<CanStartScriptHandler> CanStartScriptCheckFunctions = new List<CanStartScriptHandler>();
672
673 public void AddStartScriptHandler(CanStartScriptHandler delegateFunc)
674 {
675 if (!CanStartScriptCheckFunctions.Contains(delegateFunc))
676 CanStartScriptCheckFunctions.Add(delegateFunc);
677 }
678
679 public void RemoveStartScriptHandler(CanStartScriptHandler delegateFunc)
680 {
681 if (CanStartScriptCheckFunctions.Contains(delegateFunc))
682 CanStartScriptCheckFunctions.Remove(delegateFunc);
683 }
684
685 public bool CanStartScript(UUID script, UUID user)
686 {
687 foreach (CanStartScriptHandler check in CanStartScriptCheckFunctions)
688 {
689 if (check(script, user, m_scene) == false)
690 {
691 return false;
692 }
693 }
694 return true;
695 }
696
697 #endregion
698
699 #region STOP SCRIPT (When Script run box is unchecked after placed in object)
700 public delegate bool CanStopScriptHandler(UUID script, UUID user, Scene scene);
701 private List<CanStopScriptHandler> CanStopScriptCheckFunctions = new List<CanStopScriptHandler>();
702
703 public void AddStopScriptHandler(CanStopScriptHandler delegateFunc)
704 {
705 if (!CanStopScriptCheckFunctions.Contains(delegateFunc))
706 CanStopScriptCheckFunctions.Add(delegateFunc);
707 }
708
709 public void RemoveStopScriptHandler(CanStopScriptHandler delegateFunc)
710 {
711 if (CanStopScriptCheckFunctions.Contains(delegateFunc))
712 CanStopScriptCheckFunctions.Remove(delegateFunc);
713 }
714
715 public bool CanStopScript(UUID script, UUID user)
716 {
717 foreach (CanStopScriptHandler check in CanStopScriptCheckFunctions)
718 {
719 if (check(script, user, m_scene) == false)
720 {
721 return false;
722 }
723 }
724 return true;
725 }
726
727 #endregion
728
729 #region RESET SCRIPT
730 public delegate bool CanResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
731 private List<CanResetScriptHandler> CanResetScriptCheckFunctions = new List<CanResetScriptHandler>();
732
733 public void AddResetScriptHandler(CanResetScriptHandler delegateFunc)
734 {
735 if (!CanResetScriptCheckFunctions.Contains(delegateFunc))
736 CanResetScriptCheckFunctions.Add(delegateFunc);
737 }
738
739 public void RemoveResetScriptHandler(CanResetScriptHandler delegateFunc)
740 {
741 if (CanResetScriptCheckFunctions.Contains(delegateFunc))
742 CanResetScriptCheckFunctions.Remove(delegateFunc);
743 }
744
745 public bool CanResetScript(UUID prim, UUID script, UUID user)
746 {
747 foreach (CanResetScriptHandler check in CanResetScriptCheckFunctions)
748 {
749 if (check(prim, script, user, m_scene) == false)
750 {
751 return false;
752 }
753 }
754 return true;
755 }
756
757 #endregion
758
759 #region TERRAFORM LAND
760 public delegate bool CanTerraformLandHandler(UUID user, Vector3 position, Scene requestFromScene);
761 private List<CanTerraformLandHandler> CanTerraformLandCheckFunctions = new List<CanTerraformLandHandler>();
762
763 public void AddTerraformLandHandler(CanTerraformLandHandler delegateFunc)
764 {
765 if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
766 CanTerraformLandCheckFunctions.Add(delegateFunc);
767 }
768
769 public void RemoveTerraformLandHandler(CanTerraformLandHandler delegateFunc)
770 {
771 if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
772 CanTerraformLandCheckFunctions.Remove(delegateFunc);
773 }
774
775 public bool CanTerraformLand(UUID user, Vector3 pos)
776 {
777 foreach (CanTerraformLandHandler check in CanTerraformLandCheckFunctions)
778 {
779 if (check(user, pos, m_scene) == false)
780 {
781 return false;
782 }
783 }
784 return true;
785 }
786
787 #endregion
788
789 #region RUN CONSOLE COMMAND
790 public delegate bool CanRunConsoleCommandHandler(UUID user, Scene requestFromScene);
791 private List<CanRunConsoleCommandHandler> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommandHandler>();
792
793 public void AddRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
794 {
795 if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
796 CanRunConsoleCommandCheckFunctions.Add(delegateFunc);
797 }
798
799 public void RemoveRunConsoleCommandHandler(CanRunConsoleCommandHandler delegateFunc)
800 {
801 if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
802 CanRunConsoleCommandCheckFunctions.Remove(delegateFunc);
803 }
804
805 public bool CanRunConsoleCommand(UUID user)
806 {
807 foreach (CanRunConsoleCommandHandler check in CanRunConsoleCommandCheckFunctions)
808 {
809 if (check(user, m_scene) == false)
810 {
811 return false;
812 }
813 }
814 return true;
815 }
816
817 #endregion
818
819 #region CAN ISSUE ESTATE COMMAND
820 public delegate bool CanIssueEstateCommandHandler(UUID user, Scene requestFromScene, bool ownerCommand);
821 private List<CanIssueEstateCommandHandler> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommandHandler>();
822
823 public void AddIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
824 {
825 if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
826 CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
827 }
828
829 public void RemoveIssueEstateCommandHandler(CanIssueEstateCommandHandler delegateFunc)
830 {
831 if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
832 CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
833 }
834
835 public bool CanIssueEstateCommand(UUID user, bool ownerCommand)
836 {
837 foreach (CanIssueEstateCommandHandler check in CanIssueEstateCommandCheckFunctions)
838 {
839 if (check(user, m_scene, ownerCommand) == false)
840 {
841 return false;
842 }
843 }
844 return true;
845 }
846 #endregion
847
848 #region CAN BE GODLIKE
849 public delegate bool IsGodHandler(UUID user, Scene requestFromScene);
850 private List<IsGodHandler> IsGodCheckFunctions = new List<IsGodHandler>();
851
852 public void AddIsGodHandler(IsGodHandler delegateFunc)
853 {
854 if (!IsGodCheckFunctions.Contains(delegateFunc))
855 IsGodCheckFunctions.Add(delegateFunc);
856 }
857
858 public void RemoveIsGodHandler(IsGodHandler delegateFunc)
859 {
860 if (IsGodCheckFunctions.Contains(delegateFunc))
861 IsGodCheckFunctions.Remove(delegateFunc);
862 }
863
864 public bool IsGod(UUID user)
865 {
866 foreach (IsGodHandler check in IsGodCheckFunctions)
867 {
868 if (check(user, m_scene) == false)
869 {
870 return false;
871 }
872 }
873 return true;
874 }
875 #endregion
876
877 #region EDIT PARCEL
878 public delegate bool CanEditParcelHandler(UUID user, ILandObject parcel, Scene scene);
879 private List<CanEditParcelHandler> CanEditParcelCheckFunctions = new List<CanEditParcelHandler>();
880
881 public void AddEditParcelHandler(CanEditParcelHandler delegateFunc)
882 {
883 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
884 CanEditParcelCheckFunctions.Add(delegateFunc);
885 }
886
887 public void RemoveEditParcelHandler(CanEditParcelHandler delegateFunc)
888 {
889 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
890 CanEditParcelCheckFunctions.Remove(delegateFunc);
891 }
892
893 public bool CanEditParcel(UUID user, ILandObject parcel)
894 {
895 foreach (CanEditParcelHandler check in CanEditParcelCheckFunctions)
896 {
897 if (check(user, parcel, m_scene) == false)
898 {
899 return false;
900 }
901 }
902 return true;
903 }
904 #endregion
905
906 #region SELL PARCEL
907 public delegate bool CanSellParcelHandler(UUID user, ILandObject parcel, Scene scene);
908 private List<CanSellParcelHandler> CanSellParcelCheckFunctions = new List<CanSellParcelHandler>();
909
910 public void AddSellParcelHandler(CanSellParcelHandler delegateFunc)
911 {
912 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
913 CanSellParcelCheckFunctions.Add(delegateFunc);
914 }
915
916 public void RemoveSellParcelHandler(CanSellParcelHandler delegateFunc)
917 {
918 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
919 CanSellParcelCheckFunctions.Remove(delegateFunc);
920 }
921
922 public bool CanSellParcel(UUID user, ILandObject parcel)
923 {
924 foreach (CanSellParcelHandler check in CanSellParcelCheckFunctions)
925 {
926 if (check(user, parcel, m_scene) == false)
927 {
928 return false;
929 }
930 }
931 return true;
932 }
933 #endregion
934
935 #region ABANDON PARCEL
936 public delegate bool CanAbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
937 private List<CanAbandonParcelHandler> CanAbandonParcelCheckFunctions = new List<CanAbandonParcelHandler>();
938
939 public void AddAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
940 {
941 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
942 CanAbandonParcelCheckFunctions.Add(delegateFunc);
943 }
944
945 public void RemoveAbandonParcelHandler(CanAbandonParcelHandler delegateFunc)
946 {
947 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
948 CanAbandonParcelCheckFunctions.Remove(delegateFunc);
949 }
950
951 public bool CanAbandonParcel(UUID user, ILandObject parcel)
952 {
953 foreach (CanAbandonParcelHandler check in CanAbandonParcelCheckFunctions)
954 {
955 if (check(user, parcel, m_scene) == false)
956 {
957 return false;
958 }
959 }
960 return true;
961 }
962 #endregion
963
964 public delegate bool CanReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
965 private List<CanReclaimParcelHandler> CanReclaimParcelCheckFunctions = new List<CanReclaimParcelHandler>();
966
967 public void AddReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
968 {
969 if (!CanReclaimParcelCheckFunctions.Contains(delegateFunc))
970 CanReclaimParcelCheckFunctions.Add(delegateFunc);
971 }
972
973 public void RemoveReclaimParcelHandler(CanReclaimParcelHandler delegateFunc)
974 {
975 if (CanReclaimParcelCheckFunctions.Contains(delegateFunc))
976 CanReclaimParcelCheckFunctions.Remove(delegateFunc);
977 }
978
979 public bool CanReclaimParcel(UUID user, ILandObject parcel)
980 {
981 foreach (CanReclaimParcelHandler check in CanReclaimParcelCheckFunctions)
982 {
983 if (check(user, parcel, m_scene) == false)
984 {
985 return false;
986 }
987 }
988 return true;
989 }
990 public delegate bool CanBuyLandHandler(UUID user, ILandObject parcel, Scene scene);
991 private List<CanBuyLandHandler> CanBuyLandCheckFunctions = new List<CanBuyLandHandler>();
992
993 public void AddCanBuyLandHandler(CanBuyLandHandler delegateFunc)
994 {
995 if (!CanBuyLandCheckFunctions.Contains(delegateFunc))
996 CanBuyLandCheckFunctions.Add(delegateFunc);
997 }
998
999 public void RemoveCanBuyLandHandler(CanBuyLandHandler delegateFunc)
1000 {
1001 if (CanBuyLandCheckFunctions.Contains(delegateFunc))
1002 CanBuyLandCheckFunctions.Remove(delegateFunc);
1003 }
1004
1005 public bool CanBuyLand(UUID user, ILandObject parcel)
1006 {
1007 foreach (CanBuyLandHandler check in CanBuyLandCheckFunctions)
1008 {
1009 if (check(user, parcel, m_scene) == false)
1010 {
1011 return false;
1012 }
1013 }
1014 return true;
1015 }
1016
1017 public delegate bool CanLinkObjectHandler(UUID user, UUID objectID);
1018 private List<CanLinkObjectHandler> CanLinkObjectCheckFunctions = new List<CanLinkObjectHandler>();
1019
1020 public void AddCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
1021 {
1022 if (!CanLinkObjectCheckFunctions.Contains(delegateFunc))
1023 CanLinkObjectCheckFunctions.Add(delegateFunc);
1024 }
1025
1026 public void RemoveCanLinkObjectHandler(CanLinkObjectHandler delegateFunc)
1027 {
1028 if (CanLinkObjectCheckFunctions.Contains(delegateFunc))
1029 CanLinkObjectCheckFunctions.Remove(delegateFunc);
1030 }
1031
1032 public bool CanLinkObject(UUID user, UUID objectID)
1033 {
1034 foreach (CanLinkObjectHandler check in CanLinkObjectCheckFunctions)
1035 {
1036 if (check(user, objectID) == false)
1037 {
1038 return false;
1039 }
1040 }
1041 return true;
1042 }
1043
1044 public delegate bool CanDelinkObjectHandler(UUID user, UUID objectID);
1045 private List<CanDelinkObjectHandler> CanDelinkObjectCheckFunctions = new List<CanDelinkObjectHandler>();
1046
1047 public void AddCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
1048 {
1049 if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc))
1050 CanDelinkObjectCheckFunctions.Add(delegateFunc);
1051 }
1052
1053 public void RemoveCanDelinkObjectHandler(CanDelinkObjectHandler delegateFunc)
1054 {
1055 if (CanDelinkObjectCheckFunctions.Contains(delegateFunc))
1056 CanDelinkObjectCheckFunctions.Remove(delegateFunc);
1057 }
1058
1059 public bool CanDelinkObject(UUID user, UUID objectID)
1060 {
1061 foreach (CanDelinkObjectHandler check in CanDelinkObjectCheckFunctions)
1062 {
1063 if (check(user, objectID) == false)
1064 {
1065 return false;
1066 }
1067 }
1068 return true;
1069 }
1070
1071 #endregion
1072
1073 public delegate bool CanCreateObjectInventoryHandler(int invType, UUID objectID, UUID userID);
1074 private List<CanCreateObjectInventoryHandler> CanCreateObjectInventoryCheckFunctions
1075 = new List<CanCreateObjectInventoryHandler>();
1076
1077
1078 public void AddCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
1079 {
1080 if (!CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
1081 CanCreateObjectInventoryCheckFunctions.Add(delegateFunc);
1082 }
1083
1084 public void RemoveCanCreateObjectInventoryHandler(CanCreateObjectInventoryHandler delegateFunc)
1085 {
1086 if (CanCreateObjectInventoryCheckFunctions.Contains(delegateFunc))
1087 CanCreateObjectInventoryCheckFunctions.Remove(delegateFunc);
1088 }
1089
1090 /// <summary>
1091 /// Check whether the specified user is allowed to directly create the given inventory type in a prim's
1092 /// inventory (e.g. the New Script button in the 1.21 Linden Lab client).
1093 /// </summary>
1094 /// <param name="invType"></param>
1095 /// <param name="objectID"></param>
1096 /// <param name="userID"></param>
1097 /// <returns></returns>
1098 public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
1099 {
1100 foreach (CanCreateObjectInventoryHandler check in CanCreateObjectInventoryCheckFunctions)
1101 {
1102 if (check(invType, objectID, userID) == false)
1103 {
1104 return false;
1105 }
1106 }
1107
1108 return true;
1109 }
1110
1111 public delegate bool CanCopyObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
1112 private List<CanCopyObjectInventoryHandler> CanCopyObjectInventoryCheckFunctions = new List<CanCopyObjectInventoryHandler>();
1113
1114 public void AddCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
1115 {
1116 if (!CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
1117 CanCopyObjectInventoryCheckFunctions.Add(delegateFunc);
1118 }
1119
1120 public void RemoveCanCopyObjectInventoryHandler(CanCopyObjectInventoryHandler delegateFunc)
1121 {
1122 if (CanCopyObjectInventoryCheckFunctions.Contains(delegateFunc))
1123 CanCopyObjectInventoryCheckFunctions.Remove(delegateFunc);
1124 }
1125
1126 public bool CanCopyObjectInventory(UUID itemID, UUID objectID, UUID userID)
1127 {
1128 foreach (CanCopyObjectInventoryHandler check in CanCopyObjectInventoryCheckFunctions)
1129 {
1130 if (check(itemID, objectID, userID) == false)
1131 {
1132 return false;
1133 }
1134 }
1135 return true;
1136 }
1137
1138 public delegate bool CanDeleteObjectInventoryHandler(UUID itemID, UUID objectID, UUID userID);
1139 private List<CanDeleteObjectInventoryHandler> CanDeleteObjectInventoryCheckFunctions
1140 = new List<CanDeleteObjectInventoryHandler>();
1141
1142 public void AddCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
1143 {
1144 if (!CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
1145 CanDeleteObjectInventoryCheckFunctions.Add(delegateFunc);
1146 }
1147
1148 public void RemoveCanDeleteObjectInventoryHandler(CanDeleteObjectInventoryHandler delegateFunc)
1149 {
1150 if (CanDeleteObjectInventoryCheckFunctions.Contains(delegateFunc))
1151 CanDeleteObjectInventoryCheckFunctions.Remove(delegateFunc);
1152 }
1153
1154 public bool CanDeleteObjectInventory(UUID itemID, UUID objectID, UUID userID)
1155 {
1156 foreach (CanDeleteObjectInventoryHandler check in CanDeleteObjectInventoryCheckFunctions)
1157 {
1158 if (check(itemID, objectID, userID) == false)
1159 {
1160 return false;
1161 }
1162 }
1163
1164 return true;
1165 }
1166
1167 public delegate bool CanCreateUserInventoryHandler(int invType, UUID userID);
1168 private List<CanCreateUserInventoryHandler> CanCreateUserInventoryCheckFunctions
1169 = new List<CanCreateUserInventoryHandler>();
1170
1171 public void AddCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
1172 {
1173 if (!CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
1174 CanCreateUserInventoryCheckFunctions.Add(delegateFunc);
1175 }
1176
1177 public void RemoveCanCreateUserInventoryHandler(CanCreateUserInventoryHandler delegateFunc)
1178 {
1179 if (CanCreateUserInventoryCheckFunctions.Contains(delegateFunc))
1180 CanCreateUserInventoryCheckFunctions.Remove(delegateFunc);
1181 }
1182
1183 /// <summary>
1184 /// Check whether the specified user is allowed to create the given inventory type in their inventory.
1185 /// </summary>
1186 /// <param name="invType"></param>
1187 /// <param name="userID"></param>
1188 /// <returns></returns>
1189 public bool CanCreateUserInventory(int invType, UUID userID)
1190 {
1191 foreach (CanCreateUserInventoryHandler check in CanCreateUserInventoryCheckFunctions)
1192 {
1193 if (check(invType, userID) == false)
1194 {
1195 return false;
1196 }
1197 }
1198
1199 return true;
1200 }
1201
1202 public delegate bool CanEditUserInventoryHandler(UUID itemID, UUID userID);
1203 private List<CanEditUserInventoryHandler> CanEditUserInventoryCheckFunctions
1204 = new List<CanEditUserInventoryHandler>();
1205
1206 public void AddCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
1207 {
1208 if (!CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
1209 CanEditUserInventoryCheckFunctions.Add(delegateFunc);
1210 }
1211
1212 public void RemoveCanEditUserInventoryHandler(CanEditUserInventoryHandler delegateFunc)
1213 {
1214 if (CanEditUserInventoryCheckFunctions.Contains(delegateFunc))
1215 CanEditUserInventoryCheckFunctions.Remove(delegateFunc);
1216 }
1217
1218 /// <summary>
1219 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1220 /// </summary>
1221 /// <param name="itemID"></param>
1222 /// <param name="userID"></param>
1223 /// <returns></returns>
1224 public bool CanEditUserInventory(UUID itemID, UUID userID)
1225 {
1226 foreach (CanEditUserInventoryHandler check in CanEditUserInventoryCheckFunctions)
1227 {
1228 if (check(itemID, userID) == false)
1229 {
1230 return false;
1231 }
1232 }
1233
1234 return true;
1235 }
1236
1237 public delegate bool CanCopyUserInventoryHandler(UUID itemID, UUID userID);
1238 private List<CanCopyUserInventoryHandler> CanCopyUserInventoryCheckFunctions
1239 = new List<CanCopyUserInventoryHandler>();
1240
1241 public void AddCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
1242 {
1243 if (!CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
1244 CanCopyUserInventoryCheckFunctions.Add(delegateFunc);
1245 }
1246
1247 public void RemoveCanCopyUserInventoryHandler(CanCopyUserInventoryHandler delegateFunc)
1248 {
1249 if (CanCopyUserInventoryCheckFunctions.Contains(delegateFunc))
1250 CanCopyUserInventoryCheckFunctions.Remove(delegateFunc);
1251 }
1252
1253 /// <summary>
1254 /// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
1255 /// </summary>
1256 /// <param name="itemID"></param>
1257 /// <param name="userID"></param>
1258 /// <returns></returns>
1259 public bool CanCopyUserInventory(UUID itemID, UUID userID)
1260 {
1261 foreach (CanCopyUserInventoryHandler check in CanCopyUserInventoryCheckFunctions)
1262 {
1263 if (check(itemID, userID) == false)
1264 {
1265 return false;
1266 }
1267 }
1268
1269 return true;
1270 }
1271
1272 public delegate bool CanDeleteUserInventoryHandler(UUID itemID, UUID userID);
1273 private List<CanDeleteUserInventoryHandler> CanDeleteUserInventoryCheckFunctions
1274 = new List<CanDeleteUserInventoryHandler>();
1275
1276 public void AddCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
1277 {
1278 if (!CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
1279 CanDeleteUserInventoryCheckFunctions.Add(delegateFunc);
1280 }
1281
1282 public void RemoveCanDeleteUserInventoryHandler(CanDeleteUserInventoryHandler delegateFunc)
1283 {
1284 if (CanDeleteUserInventoryCheckFunctions.Contains(delegateFunc))
1285 CanDeleteUserInventoryCheckFunctions.Remove(delegateFunc);
1286 }
1287
1288 /// <summary>
1289 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1290 /// </summary>
1291 /// <param name="itemID"></param>
1292 /// <param name="userID"></param>
1293 /// <returns></returns>
1294 public bool CanDeleteUserInventory(UUID itemID, UUID userID)
1295 {
1296 foreach (CanDeleteUserInventoryHandler check in CanDeleteUserInventoryCheckFunctions)
1297 {
1298 if (check(itemID, userID) == false)
1299 {
1300 return false;
1301 }
1302 }
1303
1304 return true;
1305 }
1306
1307 public delegate bool CanTeleportHandler(UUID userID);
1308 private List<CanTeleportHandler> CanTeleportCheckFunctions = new List<CanTeleportHandler>();
1309
1310 public void AddCanTeleportHandler(CanTeleportHandler delegateFunc)
1311 {
1312 if (!CanTeleportCheckFunctions.Contains(delegateFunc))
1313 CanTeleportCheckFunctions.Add(delegateFunc);
1314 }
1315
1316 public void RemoveCanTeleportHandler(CanTeleportHandler delegateFunc)
1317 {
1318 if (CanTeleportCheckFunctions.Contains(delegateFunc))
1319 CanTeleportCheckFunctions.Remove(delegateFunc);
1320 }
1321
1322 public bool CanTeleport(UUID userID)
1323 {
1324 foreach (CanTeleportHandler check in CanTeleportCheckFunctions)
1325 {
1326 if (check(userID) == false)
1327 {
1328 return false;
1329 }
1330 }
1331 return true;
1332 }
1333 }
1334}