aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs581
1 files changed, 541 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index 2d3e8e4..4e579b6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Environment.Interfaces;
33 34
34namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
35{ 36{
@@ -42,63 +43,563 @@ namespace OpenSim.Region.Environment.Scenes
42 m_scene = scene; 43 m_scene = scene;
43 } 44 }
44 45
45 #region REZ OBJECT 46 #region Object Permission Checks
46 public delegate bool CanRezObject(int objectCount, LLUUID owner, IScene scene, LLVector3 objectPosition);
47 private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
48 47
49 public void addCheckRezObject(CanRezObject delegateFunc) 48 #region REZ OBJECT
50 { 49 public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
51 if(!CanRezObjectCheckFunctions.Contains(delegateFunc)) 50 private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
52 CanRezObjectCheckFunctions.Add(delegateFunc);
53 }
54 public void removeCheckRezObject(CanRezObject delegateFunc)
55 {
56 if (CanRezObjectCheckFunctions.Contains(delegateFunc))
57 CanRezObjectCheckFunctions.Remove(delegateFunc);
58 }
59 51
60 public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition) 52 public void addCheckRezObject(CanRezObject delegateFunc)
61 { 53 {
62 foreach (CanRezObject check in CanRezObjectCheckFunctions) 54 if(!CanRezObjectCheckFunctions.Contains(delegateFunc))
55 CanRezObjectCheckFunctions.Add(delegateFunc);
56 }
57 public void removeCheckRezObject(CanRezObject delegateFunc)
58 {
59 if (CanRezObjectCheckFunctions.Contains(delegateFunc))
60 CanRezObjectCheckFunctions.Remove(delegateFunc);
61 }
62
63 public bool ExternalChecksCanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition)
63 { 64 {
64 if (check(objectCount, owner, m_scene, objectPosition) == false) 65 foreach (CanRezObject check in CanRezObjectCheckFunctions)
65 { 66 {
66 return false; 67 if (check(objectCount, owner,objectPosition, m_scene) == false)
68 {
69 return false;
70 }
67 } 71 }
72 return true;
68 } 73 }
69 return true; 74
70 } 75 #endregion
76
77 #region DEREZ OBJECT
78 public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene);
79 private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>();
80
81 public void addCheckDeRezObject(CanDeRezObject delegateFunc)
82 {
83 if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc))
84 CanDeRezObjectCheckFunctions.Add(delegateFunc);
85 }
86 public void removeCheckDeRezObject(CanDeRezObject delegateFunc)
87 {
88 if (CanDeRezObjectCheckFunctions.Contains(delegateFunc))
89 CanDeRezObjectCheckFunctions.Remove(delegateFunc);
90 }
91
92 public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter)
93 {
94 foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions)
95 {
96 if (check(objectID,deleter,m_scene) == false)
97 {
98 return false;
99 }
100 }
101 return true;
102 }
103
104 #endregion
105
106 #region TAKE OBJECT
107 public delegate bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene);
108 private List<CanTakeObject> CanTakeObjectCheckFunctions = new List<CanTakeObject>();
109
110 public void addCheckTakeObject(CanTakeObject delegateFunc)
111 {
112 if (!CanTakeObjectCheckFunctions.Contains(delegateFunc))
113 CanTakeObjectCheckFunctions.Add(delegateFunc);
114 }
115 public void removeCheckTakeObject(CanTakeObject delegateFunc)
116 {
117 if (CanTakeObjectCheckFunctions.Contains(delegateFunc))
118 CanTakeObjectCheckFunctions.Remove(delegateFunc);
119 }
120
121 public bool ExternalChecksCanTakeObject(LLUUID objectID, LLUUID stealer)
122 {
123 foreach (CanTakeObject check in CanTakeObjectCheckFunctions)
124 {
125 if (check(objectID, stealer, m_scene) == false)
126 {
127 return false;
128 }
129 }
130 return true;
131 }
132
133 #endregion
134
135 #region COPY OBJECT
136 public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
137 private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>();
138
139 public void addCheckCopyObject(CanCopyObject delegateFunc)
140 {
141 if (!CanCopyObjectCheckFunctions.Contains(delegateFunc))
142 CanCopyObjectCheckFunctions.Add(delegateFunc);
143 }
144 public void removeCheckCopyObject(CanCopyObject delegateFunc)
145 {
146 if (CanCopyObjectCheckFunctions.Contains(delegateFunc))
147 CanCopyObjectCheckFunctions.Remove(delegateFunc);
148 }
149
150 public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
151 {
152 foreach (CanCopyObject check in CanCopyObjectCheckFunctions)
153 {
154 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
155 {
156 return false;
157 }
158 }
159 return true;
160 }
161
162 #endregion
163
164 #region EDIT OBJECT
165 public delegate bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene);
166 private List<CanEditObject> CanEditObjectCheckFunctions = new List<CanEditObject>();
167
168 public void addCheckEditObject(CanEditObject delegateFunc)
169 {
170 if (!CanEditObjectCheckFunctions.Contains(delegateFunc))
171 CanEditObjectCheckFunctions.Add(delegateFunc);
172 }
173 public void removeCheckEditObject(CanEditObject delegateFunc)
174 {
175 if (CanEditObjectCheckFunctions.Contains(delegateFunc))
176 CanEditObjectCheckFunctions.Remove(delegateFunc);
177 }
178
179 public bool ExternalChecksCanEditObject(LLUUID objectID, LLUUID editorID)
180 {
181 foreach (CanEditObject check in CanEditObjectCheckFunctions)
182 {
183 if (check(objectID, editorID, m_scene) == false)
184 {
185 return false;
186 }
187 }
188 return true;
189 }
190
191 #endregion
192
193 #region MOVE OBJECT
194 public delegate bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene);
195 private List<CanMoveObject> CanMoveObjectCheckFunctions = new List<CanMoveObject>();
196
197 public void addCheckMoveObject(CanMoveObject delegateFunc)
198 {
199 if (!CanMoveObjectCheckFunctions.Contains(delegateFunc))
200 CanMoveObjectCheckFunctions.Add(delegateFunc);
201 }
202 public void removeCheckMoveObject(CanMoveObject delegateFunc)
203 {
204 if (CanMoveObjectCheckFunctions.Contains(delegateFunc))
205 CanMoveObjectCheckFunctions.Remove(delegateFunc);
206 }
207
208 public bool ExternalChecksCanMoveObject(LLUUID objectID, LLUUID moverID)
209 {
210 foreach (CanMoveObject check in CanMoveObjectCheckFunctions)
211 {
212 if (check(objectID,moverID,m_scene) == false)
213 {
214 return false;
215 }
216 }
217 return true;
218 }
219
220 #endregion
221
222 #region RETURN OBJECT
223 public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene);
224 private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>();
225
226 public void addCheckReturnObject(CanReturnObject delegateFunc)
227 {
228 if (!CanReturnObjectCheckFunctions.Contains(delegateFunc))
229 CanReturnObjectCheckFunctions.Add(delegateFunc);
230 }
231 public void removeCheckReturnObject(CanReturnObject delegateFunc)
232 {
233 if (CanReturnObjectCheckFunctions.Contains(delegateFunc))
234 CanReturnObjectCheckFunctions.Remove(delegateFunc);
235 }
236
237 public bool ExternalChecksCanReturnObject(LLUUID objectID, LLUUID returnerID)
238 {
239 foreach (CanReturnObject check in CanReturnObjectCheckFunctions)
240 {
241 if (check(objectID,returnerID,m_scene) == false)
242 {
243 return false;
244 }
245 }
246 return true;
247 }
248
249 #endregion
71 250
72 #endregion 251 #endregion
73 252
74 #region RUN SCRIPT 253 #region Misc Permission Checks
75 public delegate bool CanRunScript(LLUUID script, LLUUID owner, IScene scene);
76 private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
77 254
78 public void addCheckRunScript(CanRunScript delegateFunc) 255 #region INSTANT MESSAGE
79 { 256 public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene);
80 if (!CanRunScriptCheckFunctions.Contains(delegateFunc)) 257 private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>();
81 CanRunScriptCheckFunctions.Add(delegateFunc);
82 }
83 public void removeCheckRunScript(CanRunScript delegateFunc)
84 {
85 if (CanRunScriptCheckFunctions.Contains(delegateFunc))
86 CanRunScriptCheckFunctions.Remove(delegateFunc);
87 }
88 258
89 public bool ExternalChecksCanRunScript(LLUUID script, LLUUID owner) 259 public void addCheckInstantMessage(CanInstantMessage delegateFunc)
90 { 260 {
91 foreach (CanRunScript check in CanRunScriptCheckFunctions) 261 if (!CanInstantMessageCheckFunctions.Contains(delegateFunc))
262 CanInstantMessageCheckFunctions.Add(delegateFunc);
263 }
264 public void removeCheckInstantMessage(CanInstantMessage delegateFunc)
265 {
266 if (CanInstantMessageCheckFunctions.Contains(delegateFunc))
267 CanInstantMessageCheckFunctions.Remove(delegateFunc);
268 }
269
270 public bool ExternalChecksCanInstantMessage(LLUUID user, LLUUID target)
92 { 271 {
93 if (check(script,owner,m_scene) == false) 272 foreach (CanInstantMessage check in CanInstantMessageCheckFunctions)
94 { 273 {
95 return false; 274 if (check(user,target,m_scene) == false)
275 {
276 return false;
277 }
96 } 278 }
279 return true;
97 } 280 }
98 return true; 281
99 } 282 #endregion
283
284 #region INVENTORY TRANSFER
285 public delegate bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene);
286 private List<CanInventoryTransfer> CanInventoryTransferCheckFunctions = new List<CanInventoryTransfer>();
287
288 public void addCheckInventoryTransfer(CanInventoryTransfer delegateFunc)
289 {
290 if (!CanInventoryTransferCheckFunctions.Contains(delegateFunc))
291 CanInventoryTransferCheckFunctions.Add(delegateFunc);
292 }
293 public void removeCheckInventoryTransfer(CanInventoryTransfer delegateFunc)
294 {
295 if (CanInventoryTransferCheckFunctions.Contains(delegateFunc))
296 CanInventoryTransferCheckFunctions.Remove(delegateFunc);
297 }
298
299 public bool ExternalChecksCanInventoryTransfer(LLUUID user, LLUUID target)
300 {
301 foreach (CanInventoryTransfer check in CanInventoryTransferCheckFunctions)
302 {
303 if (check(user, target, m_scene) == false)
304 {
305 return false;
306 }
307 }
308 return true;
309 }
310
311 #endregion
312
313 #region EDIT SCRIPT
314 public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene);
315 private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
316
317 public void addCheckEditScript(CanEditScript delegateFunc)
318 {
319 if (!CanEditScriptCheckFunctions.Contains(delegateFunc))
320 CanEditScriptCheckFunctions.Add(delegateFunc);
321 }
322 public void removeCheckEditScript(CanEditScript delegateFunc)
323 {
324 if (CanEditScriptCheckFunctions.Contains(delegateFunc))
325 CanEditScriptCheckFunctions.Remove(delegateFunc);
326 }
327
328 public bool ExternalChecksCanEditScript(LLUUID script, LLUUID user)
329 {
330 foreach (CanEditScript check in CanEditScriptCheckFunctions)
331 {
332 if (check(script, user, m_scene) == false)
333 {
334 return false;
335 }
336 }
337 return true;
338 }
339
340 #endregion
341
342 #region RUN SCRIPT
343 public delegate bool CanRunScript(LLUUID script, LLUUID user, Scene scene);
344 private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
345
346 public void addCheckRunScript(CanRunScript delegateFunc)
347 {
348 if (!CanRunScriptCheckFunctions.Contains(delegateFunc))
349 CanRunScriptCheckFunctions.Add(delegateFunc);
350 }
351 public void removeCheckRunScript(CanRunScript delegateFunc)
352 {
353 if (CanRunScriptCheckFunctions.Contains(delegateFunc))
354 CanRunScriptCheckFunctions.Remove(delegateFunc);
355 }
356
357 public bool ExternalChecksCanRunScript(LLUUID script, LLUUID user)
358 {
359 foreach (CanRunScript check in CanRunScriptCheckFunctions)
360 {
361 if (check(script, user, m_scene) == false)
362 {
363 return false;
364 }
365 }
366 return true;
367 }
368
369 #endregion
370
371 #region TERRAFORM LAND
372 public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene);
373 private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>();
374
375 public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc)
376 {
377 if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc))
378 CanTerraformLandCommandCheckFunctions.Add(delegateFunc);
379 }
380 public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc)
381 {
382 if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc))
383 CanTerraformLandCommandCheckFunctions.Remove(delegateFunc);
384 }
385
386 public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos)
387 {
388 foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions)
389 {
390 if (check(user, pos, m_scene) == false)
391 {
392 return false;
393 }
394 }
395 return true;
396 }
397
398 #endregion
399
400 #region RUN CONSOLE COMMAND
401 public delegate bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene);
402 private List<CanRunConsoleCommand> CanRunConsoleCommandCheckFunctions = new List<CanRunConsoleCommand>();
403
404 public void addCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc)
405 {
406 if (!CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
407 CanRunConsoleCommandCheckFunctions.Add(delegateFunc);
408 }
409 public void removeCheckRunConsoleCommand(CanRunConsoleCommand delegateFunc)
410 {
411 if (CanRunConsoleCommandCheckFunctions.Contains(delegateFunc))
412 CanRunConsoleCommandCheckFunctions.Remove(delegateFunc);
413 }
414
415 public bool ExternalChecksCanRunConsoleCommand(LLUUID user)
416 {
417 foreach (CanRunConsoleCommand check in CanRunConsoleCommandCheckFunctions)
418 {
419 if (check(user, m_scene) == false)
420 {
421 return false;
422 }
423 }
424 return true;
425 }
426
427 #endregion
428
429 #region CAN BE GODLIKE
430 public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene);
431 private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>();
432
433 public void addCheckBeGodLike(CanBeGodLike delegateFunc)
434 {
435 if (!CanBeGodLikeCheckFunctions.Contains(delegateFunc))
436 CanBeGodLikeCheckFunctions.Add(delegateFunc);
437 }
438 public void removeCheckBeGodLike(CanBeGodLike delegateFunc)
439 {
440 if (CanBeGodLikeCheckFunctions.Contains(delegateFunc))
441 CanBeGodLikeCheckFunctions.Remove(delegateFunc);
442 }
443
444 public bool ExternalChecksCanBeGodLike(LLUUID user)
445 {
446 foreach (CanBeGodLike check in CanBeGodLikeCheckFunctions)
447 {
448 if (check(user, m_scene) == false)
449 {
450 return false;
451 }
452 }
453 return true;
454 }
455
456 #endregion
100 457
101 #endregion 458 #endregion
102 459
460 #region Parcel and Estate Permission Checks
461 #region EDIT ESTATE TERRAIN
462 public delegate bool CanEditEstateTerrain(LLUUID user, Scene scene);
463 private List<CanEditEstateTerrain> CanEditEstateTerrainCheckFunctions = new List<CanEditEstateTerrain>();
464
465 public void addCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
466 {
467 if (!CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
468 CanEditEstateTerrainCheckFunctions.Add(delegateFunc);
469 }
470 public void removeCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
471 {
472 if (CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
473 CanEditEstateTerrainCheckFunctions.Remove(delegateFunc);
474 }
475
476 public bool ExternalChecksCanEditEstateTerrain(LLUUID user)
477 {
478 foreach (CanEditEstateTerrain check in CanEditEstateTerrainCheckFunctions)
479 {
480 if (check(user, m_scene) == false)
481 {
482 return false;
483 }
484 }
485 return true;
486 }
487
488 #endregion
489
490 #region RESTART SIM
491 public delegate bool CanRestartSim(LLUUID user, Scene scene);
492 private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>();
493
494 public void addCheckRestartSim(CanRestartSim delegateFunc)
495 {
496 if (!CanRestartSimCheckFunctions.Contains(delegateFunc))
497 CanRestartSimCheckFunctions.Add(delegateFunc);
498 }
499 public void removeCheckRestartSim(CanRestartSim delegateFunc)
500 {
501 if (CanRestartSimCheckFunctions.Contains(delegateFunc))
502 CanRestartSimCheckFunctions.Remove(delegateFunc);
503 }
504
505 public bool ExternalChecksCanRestartSim(LLUUID user)
506 {
507 foreach (CanRestartSim check in CanRestartSimCheckFunctions)
508 {
509 if (check(user, m_scene) == false)
510 {
511 return false;
512 }
513 }
514 return true;
515 }
516 #endregion
517
518 #region EDIT PARCEL
519 public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene);
520 private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>();
521
522 public void addCheckEditParcel(CanEditParcel delegateFunc)
523 {
524 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
525 CanEditParcelCheckFunctions.Add(delegateFunc);
526 }
527 public void removeCheckEditParcel(CanEditParcel delegateFunc)
528 {
529 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
530 CanEditParcelCheckFunctions.Remove(delegateFunc);
531 }
532
533 public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel)
534 {
535 foreach (CanEditParcel check in CanEditParcelCheckFunctions)
536 {
537 if (check(user, parcel, m_scene) == false)
538 {
539 return false;
540 }
541 }
542 return true;
543 }
544 #endregion
545
546 #region SELL PARCEL
547 public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene);
548 private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>();
549
550 public void addCheckSellParcel(CanSellParcel delegateFunc)
551 {
552 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
553 CanSellParcelCheckFunctions.Add(delegateFunc);
554 }
555 public void removeCheckSellParcel(CanSellParcel delegateFunc)
556 {
557 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
558 CanSellParcelCheckFunctions.Remove(delegateFunc);
559 }
560
561 public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel)
562 {
563 foreach (CanSellParcel check in CanSellParcelCheckFunctions)
564 {
565 if (check(user, parcel, m_scene) == false)
566 {
567 return false;
568 }
569 }
570 return true;
571 }
572 #endregion
573
574 #region ABANDON PARCEL
575 public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene);
576 private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>();
577
578 public void addCheckAbandonParcel(CanAbandonParcel delegateFunc)
579 {
580 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
581 CanAbandonParcelCheckFunctions.Add(delegateFunc);
582 }
583 public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc)
584 {
585 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
586 CanAbandonParcelCheckFunctions.Remove(delegateFunc);
587 }
588
589 public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel)
590 {
591 foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions)
592 {
593 if (check(user, parcel, m_scene) == false)
594 {
595 return false;
596 }
597 }
598 return true;
599 }
600 #endregion
601 #endregion
602
603
103 } 604 }
104} 605}