aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
diff options
context:
space:
mode:
authormingchen2008-05-13 16:22:57 +0000
committermingchen2008-05-13 16:22:57 +0000
commit32785921d0a4a074b92da0f4ec322cf451a4642f (patch)
treeae93cc8fb09a5d7b991e323617e3324042e30a8d /OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
parent* Remove old historical grid inventory code (diff)
downloadopensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.zip
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.gz
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.bz2
opensim-SC-32785921d0a4a074b92da0f4ec322cf451a4642f.tar.xz
*Complete redo of the permissions module
*Removed hardcoded permissions checks *Added permissions checks where needed
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs378
1 files changed, 215 insertions, 163 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index e7e4caf..285ee0d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -74,24 +74,24 @@ namespace OpenSim.Region.Environment.Scenes
74 74
75 #endregion 75 #endregion
76 76
77 #region DEREZ OBJECT 77 #region DELETE OBJECT
78 public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene); 78 public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene);
79 private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>(); 79 private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>();
80 80
81 public void addCheckDeRezObject(CanDeRezObject delegateFunc) 81 public void addCheckDeleteObject(CanDeleteObject delegateFunc)
82 { 82 {
83 if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc)) 83 if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
84 CanDeRezObjectCheckFunctions.Add(delegateFunc); 84 CanDeleteObjectCheckFunctions.Add(delegateFunc);
85 } 85 }
86 public void removeCheckDeRezObject(CanDeRezObject delegateFunc) 86 public void removeCheckDeleteObject(CanDeleteObject delegateFunc)
87 { 87 {
88 if (CanDeRezObjectCheckFunctions.Contains(delegateFunc)) 88 if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
89 CanDeRezObjectCheckFunctions.Remove(delegateFunc); 89 CanDeleteObjectCheckFunctions.Remove(delegateFunc);
90 } 90 }
91 91
92 public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter) 92 public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter)
93 { 93 {
94 foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions) 94 foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions)
95 { 95 {
96 if (check(objectID,deleter,m_scene) == false) 96 if (check(objectID,deleter,m_scene) == false)
97 { 97 {
@@ -132,24 +132,53 @@ namespace OpenSim.Region.Environment.Scenes
132 132
133 #endregion 133 #endregion
134 134
135 #region COPY OBJECT 135 #region TAKE COPY OBJECT
136 public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition); 136 public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene);
137 private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>(); 137 private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>();
138 138
139 public void addCheckCopyObject(CanCopyObject delegateFunc) 139 public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
140 { 140 {
141 if (!CanCopyObjectCheckFunctions.Contains(delegateFunc)) 141 if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
142 CanCopyObjectCheckFunctions.Add(delegateFunc); 142 CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
143 } 143 }
144 public void removeCheckCopyObject(CanCopyObject delegateFunc) 144 public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
145 { 145 {
146 if (CanCopyObjectCheckFunctions.Contains(delegateFunc)) 146 if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
147 CanCopyObjectCheckFunctions.Remove(delegateFunc); 147 CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
148 } 148 }
149 149
150 public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition) 150 public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID)
151 { 151 {
152 foreach (CanCopyObject check in CanCopyObjectCheckFunctions) 152 foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions)
153 {
154 if (check(objectID,userID,m_scene) == false)
155 {
156 return false;
157 }
158 }
159 return true;
160 }
161
162 #endregion
163
164 #region DUPLICATE OBJECT
165 public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
166 private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>();
167
168 public void addCheckDuplicateObject(CanDuplicateObject delegateFunc)
169 {
170 if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
171 CanDuplicateObjectCheckFunctions.Add(delegateFunc);
172 }
173 public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc)
174 {
175 if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
176 CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
177 }
178
179 public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
180 {
181 foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions)
153 { 182 {
154 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false) 183 if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
155 { 184 {
@@ -219,6 +248,35 @@ namespace OpenSim.Region.Environment.Scenes
219 248
220 #endregion 249 #endregion
221 250
251 #region OBJECT ENTRY
252 public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene);
253 private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>();
254
255 public void addCheckObjectEntry(CanObjectEntry delegateFunc)
256 {
257 if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
258 CanObjectEntryCheckFunctions.Add(delegateFunc);
259 }
260 public void removeCheckObjectEntry(CanObjectEntry delegateFunc)
261 {
262 if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
263 CanObjectEntryCheckFunctions.Remove(delegateFunc);
264 }
265
266 public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint)
267 {
268 foreach (CanObjectEntry check in CanObjectEntryCheckFunctions)
269 {
270 if (check(objectID, newPoint, m_scene) == false)
271 {
272 return false;
273 }
274 }
275 return true;
276 }
277
278 #endregion
279
222 #region RETURN OBJECT 280 #region RETURN OBJECT
223 public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene); 281 public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene);
224 private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>(); 282 private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>();
@@ -248,10 +306,6 @@ namespace OpenSim.Region.Environment.Scenes
248 306
249 #endregion 307 #endregion
250 308
251 #endregion
252
253 #region Misc Permission Checks
254
255 #region INSTANT MESSAGE 309 #region INSTANT MESSAGE
256 public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene); 310 public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene);
257 private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>(); 311 private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>();
@@ -271,7 +325,7 @@ namespace OpenSim.Region.Environment.Scenes
271 { 325 {
272 foreach (CanInstantMessage check in CanInstantMessageCheckFunctions) 326 foreach (CanInstantMessage check in CanInstantMessageCheckFunctions)
273 { 327 {
274 if (check(user,target,m_scene) == false) 328 if (check(user, target, m_scene) == false)
275 { 329 {
276 return false; 330 return false;
277 } 331 }
@@ -310,6 +364,35 @@ namespace OpenSim.Region.Environment.Scenes
310 364
311 #endregion 365 #endregion
312 366
367 #region VIEW SCRIPT
368 public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene);
369 private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>();
370
371 public void addCheckViewScript(CanViewScript delegateFunc)
372 {
373 if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
374 CanViewScriptCheckFunctions.Add(delegateFunc);
375 }
376 public void removeCheckViewScript(CanViewScript delegateFunc)
377 {
378 if (CanViewScriptCheckFunctions.Contains(delegateFunc))
379 CanViewScriptCheckFunctions.Remove(delegateFunc);
380 }
381
382 public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user)
383 {
384 foreach (CanViewScript check in CanViewScriptCheckFunctions)
385 {
386 if (check(script, user, m_scene) == false)
387 {
388 return false;
389 }
390 }
391 return true;
392 }
393
394 #endregion
395
313 #region EDIT SCRIPT 396 #region EDIT SCRIPT
314 public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); 397 public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene);
315 private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); 398 private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
@@ -369,23 +452,23 @@ namespace OpenSim.Region.Environment.Scenes
369 #endregion 452 #endregion
370 453
371 #region TERRAFORM LAND 454 #region TERRAFORM LAND
372 public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene); 455 public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
373 private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>(); 456 private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
374 457
375 public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) 458 public void addCheckTerraformLand(CanTerraformLand delegateFunc)
376 { 459 {
377 if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) 460 if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
378 CanTerraformLandCommandCheckFunctions.Add(delegateFunc); 461 CanTerraformLandCheckFunctions.Add(delegateFunc);
379 } 462 }
380 public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc) 463 public void removeCheckTerraformLand(CanTerraformLand delegateFunc)
381 { 464 {
382 if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc)) 465 if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
383 CanTerraformLandCommandCheckFunctions.Remove(delegateFunc); 466 CanTerraformLandCheckFunctions.Remove(delegateFunc);
384 } 467 }
385 468
386 public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos) 469 public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos)
387 { 470 {
388 foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions) 471 foreach (CanTerraformLand check in CanTerraformLandCheckFunctions)
389 { 472 {
390 if (check(user, pos, m_scene) == false) 473 if (check(user, pos, m_scene) == false)
391 { 474 {
@@ -426,6 +509,34 @@ namespace OpenSim.Region.Environment.Scenes
426 509
427 #endregion 510 #endregion
428 511
512 #region CAN ISSUE ESTATE COMMAND
513 public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene);
514 private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>();
515
516 public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
517 {
518 if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
519 CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
520 }
521 public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
522 {
523 if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
524 CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
525 }
526
527 public bool ExternalChecksCanIssueEstateCommand(LLUUID user)
528 {
529 foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions)
530 {
531 if (check(user, m_scene) == false)
532 {
533 return false;
534 }
535 }
536 return true;
537 }
538 #endregion
539
429 #region CAN BE GODLIKE 540 #region CAN BE GODLIKE
430 public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene); 541 public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene);
431 private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>(); 542 private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>();
@@ -452,154 +563,95 @@ namespace OpenSim.Region.Environment.Scenes
452 } 563 }
453 return true; 564 return true;
454 } 565 }
455
456 #endregion 566 #endregion
457 567
458 #endregion 568 #region EDIT PARCEL
459 569 public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene);
460 #region Parcel and Estate Permission Checks 570 private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>();
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 571
490 #region RESTART SIM 572 public void addCheckEditParcel(CanEditParcel delegateFunc)
491 public delegate bool CanRestartSim(LLUUID user, Scene scene); 573 {
492 private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>(); 574 if (!CanEditParcelCheckFunctions.Contains(delegateFunc))
493 575 CanEditParcelCheckFunctions.Add(delegateFunc);
494 public void addCheckRestartSim(CanRestartSim delegateFunc) 576 }
495 { 577 public void removeCheckEditParcel(CanEditParcel delegateFunc)
496 if (!CanRestartSimCheckFunctions.Contains(delegateFunc)) 578 {
497 CanRestartSimCheckFunctions.Add(delegateFunc); 579 if (CanEditParcelCheckFunctions.Contains(delegateFunc))
498 } 580 CanEditParcelCheckFunctions.Remove(delegateFunc);
499 public void removeCheckRestartSim(CanRestartSim delegateFunc) 581 }
500 {
501 if (CanRestartSimCheckFunctions.Contains(delegateFunc))
502 CanRestartSimCheckFunctions.Remove(delegateFunc);
503 }
504 582
505 public bool ExternalChecksCanRestartSim(LLUUID user) 583 public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel)
584 {
585 foreach (CanEditParcel check in CanEditParcelCheckFunctions)
506 { 586 {
507 foreach (CanRestartSim check in CanRestartSimCheckFunctions) 587 if (check(user, parcel, m_scene) == false)
508 { 588 {
509 if (check(user, m_scene) == false) 589 return false;
510 {
511 return false;
512 }
513 } 590 }
514 return true;
515 } 591 }
592 return true;
593 }
516 #endregion 594 #endregion
517 595
518 #region EDIT PARCEL 596 #region SELL PARCEL
519 public delegate bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene); 597 public delegate bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene);
520 private List<CanEditParcel> CanEditParcelCheckFunctions = new List<CanEditParcel>(); 598 private List<CanSellParcel> CanSellParcelCheckFunctions = new List<CanSellParcel>();
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 599
533 public bool ExternalChecksCanEditParcel(LLUUID user, ILandObject parcel) 600 public void addCheckSellParcel(CanSellParcel delegateFunc)
534 { 601 {
535 foreach (CanEditParcel check in CanEditParcelCheckFunctions) 602 if (!CanSellParcelCheckFunctions.Contains(delegateFunc))
536 { 603 CanSellParcelCheckFunctions.Add(delegateFunc);
537 if (check(user, parcel, m_scene) == false) 604 }
538 { 605 public void removeCheckSellParcel(CanSellParcel delegateFunc)
539 return false; 606 {
540 } 607 if (CanSellParcelCheckFunctions.Contains(delegateFunc))
541 } 608 CanSellParcelCheckFunctions.Remove(delegateFunc);
542 return true; 609 }
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 610
561 public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel) 611 public bool ExternalChecksCanSellParcel(LLUUID user, ILandObject parcel)
612 {
613 foreach (CanSellParcel check in CanSellParcelCheckFunctions)
614 {
615 if (check(user, parcel, m_scene) == false)
562 { 616 {
563 foreach (CanSellParcel check in CanSellParcelCheckFunctions) 617 return false;
564 {
565 if (check(user, parcel, m_scene) == false)
566 {
567 return false;
568 }
569 }
570 return true;
571 } 618 }
572 #endregion 619 }
620 return true;
621 }
622 #endregion
573 623
574 #region ABANDON PARCEL 624 #region ABANDON PARCEL
575 public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene); 625 public delegate bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene);
576 private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>(); 626 private List<CanAbandonParcel> CanAbandonParcelCheckFunctions = new List<CanAbandonParcel>();
577 627
578 public void addCheckAbandonParcel(CanAbandonParcel delegateFunc) 628 public void addCheckAbandonParcel(CanAbandonParcel delegateFunc)
579 { 629 {
580 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc)) 630 if (!CanAbandonParcelCheckFunctions.Contains(delegateFunc))
581 CanAbandonParcelCheckFunctions.Add(delegateFunc); 631 CanAbandonParcelCheckFunctions.Add(delegateFunc);
582 } 632 }
583 public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc) 633 public void removeCheckAbandonParcel(CanAbandonParcel delegateFunc)
584 { 634 {
585 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc)) 635 if (CanAbandonParcelCheckFunctions.Contains(delegateFunc))
586 CanAbandonParcelCheckFunctions.Remove(delegateFunc); 636 CanAbandonParcelCheckFunctions.Remove(delegateFunc);
587 } 637 }
588 638
589 public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel) 639 public bool ExternalChecksCanAbandonParcel(LLUUID user, ILandObject parcel)
640 {
641 foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions)
642 {
643 if (check(user, parcel, m_scene) == false)
590 { 644 {
591 foreach (CanAbandonParcel check in CanAbandonParcelCheckFunctions) 645 return false;
592 {
593 if (check(user, parcel, m_scene) == false)
594 {
595 return false;
596 }
597 }
598 return true;
599 } 646 }
600 #endregion 647 }
648 return true;
649 }
601 #endregion 650 #endregion
602 651
652 #endregion
653
603 654
604 } 655 }
605} 656}
657 \ No newline at end of file