diff options
author | Teravus Ovares | 2008-05-15 03:14:48 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-15 03:14:48 +0000 |
commit | bc177b1c37bff12030d978f45e94227e141e6fed (patch) | |
tree | 4004f19ade62a07101402453abc747daa117e2d7 | |
parent | * Got rid of an old crufty sleep that was being called. Thanks for your sup... (diff) | |
download | opensim-SC_OLD-bc177b1c37bff12030d978f45e94227e141e6fed.zip opensim-SC_OLD-bc177b1c37bff12030d978f45e94227e141e6fed.tar.gz opensim-SC_OLD-bc177b1c37bff12030d978f45e94227e141e6fed.tar.bz2 opensim-SC_OLD-bc177b1c37bff12030d978f45e94227e141e6fed.tar.xz |
* Committing Patch mantis 0001275: [PATCH] Add more perms-fu. From Melanie. Thanks Melanie!
* Adds hooks in the permission module for CanReadScript, CanEditScript, CanCopyInventory, CanDeleteInventory, CanEditNotecard, CanViewNotecard, CanViewScript.. and a few more. The functionality in the default module returns true.
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | 93 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | 250 |
2 files changed, 326 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 76f21f7..7cf2427 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs | |||
@@ -151,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
151 | m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED | 151 | m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED |
152 | m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED | 152 | m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED |
153 | m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED | 153 | m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED |
154 | m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED | ||
154 | m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED | 155 | m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED |
155 | m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED | 156 | m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED |
156 | m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED | 157 | m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED |
@@ -165,11 +166,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
165 | m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED | 166 | m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED |
166 | m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) | 167 | m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!) |
167 | m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED | 168 | m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED |
168 | 169 | m_scene.ExternalChecks.addCheckViewNotecard(CanViewNotecard); //NOT YET IMPLEMENTED | |
169 | //NEEDED PERMS: | 170 | m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED |
170 | //CanLinkObject | 171 | m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED |
171 | //CanDelinkObject | 172 | m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED |
172 | //CanBuyLand | 173 | m_scene.ExternalChecks.addCheckCanCopyInventory(CanCopyInventory); //NOT YET IMPLEMENTED |
174 | m_scene.ExternalChecks.addCheckCanDeleteInventory(CanDeleteInventory); //NOT YET IMPLEMENTED | ||
175 | m_scene.ExternalChecks.addCheckCanCreateInventory(CanCreateInventory); //NOT YET IMPLEMENTED | ||
176 | m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED | ||
173 | 177 | ||
174 | 178 | ||
175 | //Register Debug Commands | 179 | //Register Debug Commands |
@@ -568,7 +572,15 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
568 | return GenericParcelPermission(user, parcel); | 572 | return GenericParcelPermission(user, parcel); |
569 | } | 573 | } |
570 | 574 | ||
571 | private bool CanEditScript(LLUUID script, LLUUID user, Scene scene) | 575 | private bool CanEditScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene) |
576 | { | ||
577 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
578 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
579 | |||
580 | return true; | ||
581 | } | ||
582 | |||
583 | private bool CanEditNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene) | ||
572 | { | 584 | { |
573 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 585 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
574 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 586 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -771,7 +783,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
771 | return IsAdministrator(user); | 783 | return IsAdministrator(user); |
772 | } | 784 | } |
773 | 785 | ||
774 | private bool CanRunScript(LLUUID script, LLUUID user, Scene scene) | 786 | private bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene) |
775 | { | 787 | { |
776 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 788 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
777 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 789 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
@@ -859,15 +871,80 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions | |||
859 | return permission; | 871 | return permission; |
860 | } | 872 | } |
861 | 873 | ||
862 | private bool CanViewScript(LLUUID script, LLUUID user, Scene scene) | 874 | private bool CanViewScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene) |
875 | { | ||
876 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
877 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
878 | |||
879 | return true; | ||
880 | } | ||
881 | |||
882 | private bool CanViewNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene) | ||
863 | { | 883 | { |
864 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 884 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
865 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 885 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
866 | 886 | ||
867 | return true; | 887 | return true; |
868 | } | 888 | } |
889 | |||
869 | #endregion | 890 | #endregion |
870 | 891 | ||
892 | public bool CanLinkObject(LLUUID userID, LLUUID objectID) | ||
893 | { | ||
894 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
895 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
896 | |||
897 | return true; | ||
898 | } | ||
899 | |||
900 | public bool CanDelinkObject(LLUUID userID, LLUUID objectID) | ||
901 | { | ||
902 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
903 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
904 | |||
905 | return true; | ||
906 | } | ||
907 | |||
908 | public bool CanBuyLand(LLUUID userID, ILandObject parcel, Scene scene) | ||
909 | { | ||
910 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
911 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
912 | |||
913 | return true; | ||
914 | } | ||
915 | |||
916 | public bool CanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID) | ||
917 | { | ||
918 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
919 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
920 | |||
921 | return true; | ||
922 | } | ||
923 | |||
924 | public bool CanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID) | ||
925 | { | ||
926 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
927 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
928 | |||
929 | return true; | ||
930 | } | ||
931 | |||
932 | public bool CanCreateInventory(uint invType, LLUUID objectID, LLUUID userID) | ||
933 | { | ||
934 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
935 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
936 | |||
937 | return true; | ||
938 | } | ||
939 | |||
940 | public bool CanTeleport(LLUUID userID) | ||
941 | { | ||
942 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | ||
943 | if (m_bypassPermissions) return m_bypassPermissionsValue; | ||
944 | |||
945 | return true; | ||
946 | } | ||
947 | |||
871 | 948 | ||
872 | } | 949 | } |
873 | 950 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs index 53c8fc3..fcc6c75 100644 --- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs +++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs | |||
@@ -437,7 +437,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
437 | #endregion | 437 | #endregion |
438 | 438 | ||
439 | #region VIEW SCRIPT | 439 | #region VIEW SCRIPT |
440 | public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene); | 440 | public delegate bool CanViewScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); |
441 | private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>(); | 441 | private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>(); |
442 | 442 | ||
443 | public void addCheckViewScript(CanViewScript delegateFunc) | 443 | public void addCheckViewScript(CanViewScript delegateFunc) |
@@ -451,11 +451,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
451 | CanViewScriptCheckFunctions.Remove(delegateFunc); | 451 | CanViewScriptCheckFunctions.Remove(delegateFunc); |
452 | } | 452 | } |
453 | 453 | ||
454 | public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user) | 454 | public bool ExternalChecksCanViewScript(LLUUID script, LLUUID objectID, LLUUID user) |
455 | { | 455 | { |
456 | foreach (CanViewScript check in CanViewScriptCheckFunctions) | 456 | foreach (CanViewScript check in CanViewScriptCheckFunctions) |
457 | { | 457 | { |
458 | if (check(script, user, m_scene) == false) | 458 | if (check(script, objectID, user, m_scene) == false) |
459 | { | ||
460 | return false; | ||
461 | } | ||
462 | } | ||
463 | return true; | ||
464 | } | ||
465 | |||
466 | public delegate bool CanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); | ||
467 | private List<CanViewNotecard> CanViewNotecardCheckFunctions = new List<CanViewNotecard>(); | ||
468 | |||
469 | public void addCheckViewNotecard(CanViewNotecard delegateFunc) | ||
470 | { | ||
471 | if (!CanViewNotecardCheckFunctions.Contains(delegateFunc)) | ||
472 | CanViewNotecardCheckFunctions.Add(delegateFunc); | ||
473 | } | ||
474 | public void removeCheckViewNotecard(CanViewNotecard delegateFunc) | ||
475 | { | ||
476 | if (CanViewNotecardCheckFunctions.Contains(delegateFunc)) | ||
477 | CanViewNotecardCheckFunctions.Remove(delegateFunc); | ||
478 | } | ||
479 | |||
480 | public bool ExternalChecksCanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user) | ||
481 | { | ||
482 | foreach (CanViewNotecard check in CanViewNotecardCheckFunctions) | ||
483 | { | ||
484 | if (check(script, objectID, user, m_scene) == false) | ||
459 | { | 485 | { |
460 | return false; | 486 | return false; |
461 | } | 487 | } |
@@ -466,7 +492,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
466 | #endregion | 492 | #endregion |
467 | 493 | ||
468 | #region EDIT SCRIPT | 494 | #region EDIT SCRIPT |
469 | public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene); | 495 | public delegate bool CanEditScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); |
470 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); | 496 | private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>(); |
471 | 497 | ||
472 | public void addCheckEditScript(CanEditScript delegateFunc) | 498 | public void addCheckEditScript(CanEditScript delegateFunc) |
@@ -480,11 +506,37 @@ namespace OpenSim.Region.Environment.Scenes | |||
480 | CanEditScriptCheckFunctions.Remove(delegateFunc); | 506 | CanEditScriptCheckFunctions.Remove(delegateFunc); |
481 | } | 507 | } |
482 | 508 | ||
483 | public bool ExternalChecksCanEditScript(LLUUID script, LLUUID user) | 509 | public bool ExternalChecksCanEditScript(LLUUID script, LLUUID objectID, LLUUID user) |
484 | { | 510 | { |
485 | foreach (CanEditScript check in CanEditScriptCheckFunctions) | 511 | foreach (CanEditScript check in CanEditScriptCheckFunctions) |
486 | { | 512 | { |
487 | if (check(script, user, m_scene) == false) | 513 | if (check(script, objectID, user, m_scene) == false) |
514 | { | ||
515 | return false; | ||
516 | } | ||
517 | } | ||
518 | return true; | ||
519 | } | ||
520 | |||
521 | public delegate bool CanEditNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene); | ||
522 | private List<CanEditNotecard> CanEditNotecardCheckFunctions = new List<CanEditNotecard>(); | ||
523 | |||
524 | public void addCheckEditNotecard(CanEditNotecard delegateFunc) | ||
525 | { | ||
526 | if (!CanEditNotecardCheckFunctions.Contains(delegateFunc)) | ||
527 | CanEditNotecardCheckFunctions.Add(delegateFunc); | ||
528 | } | ||
529 | public void removeCheckEditNotecard(CanEditNotecard delegateFunc) | ||
530 | { | ||
531 | if (CanEditNotecardCheckFunctions.Contains(delegateFunc)) | ||
532 | CanEditNotecardCheckFunctions.Remove(delegateFunc); | ||
533 | } | ||
534 | |||
535 | public bool ExternalChecksCanEditNotecard(LLUUID script, LLUUID objectID, LLUUID user) | ||
536 | { | ||
537 | foreach (CanEditNotecard check in CanEditNotecardCheckFunctions) | ||
538 | { | ||
539 | if (check(script, objectID, user, m_scene) == false) | ||
488 | { | 540 | { |
489 | return false; | 541 | return false; |
490 | } | 542 | } |
@@ -495,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
495 | #endregion | 547 | #endregion |
496 | 548 | ||
497 | #region RUN SCRIPT | 549 | #region RUN SCRIPT |
498 | public delegate bool CanRunScript(LLUUID script, LLUUID user, Scene scene); | 550 | public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene); |
499 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); | 551 | private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>(); |
500 | 552 | ||
501 | public void addCheckRunScript(CanRunScript delegateFunc) | 553 | public void addCheckRunScript(CanRunScript delegateFunc) |
@@ -509,11 +561,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
509 | CanRunScriptCheckFunctions.Remove(delegateFunc); | 561 | CanRunScriptCheckFunctions.Remove(delegateFunc); |
510 | } | 562 | } |
511 | 563 | ||
512 | public bool ExternalChecksCanRunScript(LLUUID script, LLUUID user) | 564 | public bool ExternalChecksCanRunScript(LLUUID script, LLUUID objectID, LLUUID user) |
513 | { | 565 | { |
514 | foreach (CanRunScript check in CanRunScriptCheckFunctions) | 566 | foreach (CanRunScript check in CanRunScriptCheckFunctions) |
515 | { | 567 | { |
516 | if (check(script, user, m_scene) == false) | 568 | if (check(script, objectID, user, m_scene) == false) |
517 | { | 569 | { |
518 | return false; | 570 | return false; |
519 | } | 571 | } |
@@ -721,9 +773,189 @@ namespace OpenSim.Region.Environment.Scenes | |||
721 | } | 773 | } |
722 | #endregion | 774 | #endregion |
723 | 775 | ||
776 | public delegate bool CanBuyLand(LLUUID user, ILandObject parcel, Scene scene); | ||
777 | private List<CanBuyLand> CanBuyLandCheckFunctions = new List<CanBuyLand>(); | ||
778 | |||
779 | public void addCheckCanBuyLand(CanBuyLand delegateFunc) | ||
780 | { | ||
781 | if (!CanBuyLandCheckFunctions.Contains(delegateFunc)) | ||
782 | CanBuyLandCheckFunctions.Add(delegateFunc); | ||
783 | } | ||
784 | public void removeCheckCanBuyLand(CanBuyLand delegateFunc) | ||
785 | { | ||
786 | if (CanBuyLandCheckFunctions.Contains(delegateFunc)) | ||
787 | CanBuyLandCheckFunctions.Remove(delegateFunc); | ||
788 | } | ||
789 | |||
790 | public bool ExternalChecksCanBuyLand(LLUUID user, ILandObject parcel) | ||
791 | { | ||
792 | foreach (CanBuyLand check in CanBuyLandCheckFunctions) | ||
793 | { | ||
794 | if (check(user, parcel, m_scene) == false) | ||
795 | { | ||
796 | return false; | ||
797 | } | ||
798 | } | ||
799 | return true; | ||
800 | } | ||
801 | |||
802 | public delegate bool CanLinkObject(LLUUID user, LLUUID objectID); | ||
803 | private List<CanLinkObject> CanLinkObjectCheckFunctions = new List<CanLinkObject>(); | ||
804 | |||
805 | public void addCheckCanLinkObject(CanLinkObject delegateFunc) | ||
806 | { | ||
807 | if (!CanLinkObjectCheckFunctions.Contains(delegateFunc)) | ||
808 | CanLinkObjectCheckFunctions.Add(delegateFunc); | ||
809 | } | ||
810 | public void removeCheckCanLinkObject(CanLinkObject delegateFunc) | ||
811 | { | ||
812 | if (CanLinkObjectCheckFunctions.Contains(delegateFunc)) | ||
813 | CanLinkObjectCheckFunctions.Remove(delegateFunc); | ||
814 | } | ||
815 | |||
816 | public bool ExternalChecksCanLinkObject(LLUUID user, LLUUID objectID) | ||
817 | { | ||
818 | foreach (CanLinkObject check in CanLinkObjectCheckFunctions) | ||
819 | { | ||
820 | if (check(user, objectID) == false) | ||
821 | { | ||
822 | return false; | ||
823 | } | ||
824 | } | ||
825 | return true; | ||
826 | } | ||
827 | |||
828 | public delegate bool CanDelinkObject(LLUUID user, LLUUID objectID); | ||
829 | private List<CanDelinkObject> CanDelinkObjectCheckFunctions = new List<CanDelinkObject>(); | ||
830 | |||
831 | public void addCheckCanDelinkObject(CanDelinkObject delegateFunc) | ||
832 | { | ||
833 | if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc)) | ||
834 | CanDelinkObjectCheckFunctions.Add(delegateFunc); | ||
835 | } | ||
836 | public void removeCheckCanDelinkObject(CanDelinkObject delegateFunc) | ||
837 | { | ||
838 | if (CanDelinkObjectCheckFunctions.Contains(delegateFunc)) | ||
839 | CanDelinkObjectCheckFunctions.Remove(delegateFunc); | ||
840 | } | ||
841 | |||
842 | public bool ExternalChecksCanDelinkObject(LLUUID user, LLUUID objectID) | ||
843 | { | ||
844 | foreach (CanDelinkObject check in CanDelinkObjectCheckFunctions) | ||
845 | { | ||
846 | if (check(user, objectID) == false) | ||
847 | { | ||
848 | return false; | ||
849 | } | ||
850 | } | ||
851 | return true; | ||
852 | } | ||
853 | |||
724 | #endregion | 854 | #endregion |
725 | 855 | ||
856 | public delegate bool CanCreateInventory(uint invType, LLUUID objectID, LLUUID userID); | ||
857 | private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>(); | ||
858 | |||
859 | public void addCheckCanCreateInventory(CanCreateInventory delegateFunc) | ||
860 | { | ||
861 | if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc)) | ||
862 | CanCreateInventoryCheckFunctions.Add(delegateFunc); | ||
863 | } | ||
864 | public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc) | ||
865 | { | ||
866 | if (CanCreateInventoryCheckFunctions.Contains(delegateFunc)) | ||
867 | CanCreateInventoryCheckFunctions.Remove(delegateFunc); | ||
868 | } | ||
869 | |||
870 | public bool ExternalChecksCanCreateInventory(uint invType, LLUUID objectID, LLUUID userID) | ||
871 | { | ||
872 | foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions) | ||
873 | { | ||
874 | if (check(invType, objectID, userID) == false) | ||
875 | { | ||
876 | return false; | ||
877 | } | ||
878 | } | ||
879 | return true; | ||
880 | } | ||
881 | |||
882 | public delegate bool CanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID); | ||
883 | private List<CanCopyInventory> CanCopyInventoryCheckFunctions = new List<CanCopyInventory>(); | ||
726 | 884 | ||
885 | public void addCheckCanCopyInventory(CanCopyInventory delegateFunc) | ||
886 | { | ||
887 | if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc)) | ||
888 | CanCopyInventoryCheckFunctions.Add(delegateFunc); | ||
889 | } | ||
890 | public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc) | ||
891 | { | ||
892 | if (CanCopyInventoryCheckFunctions.Contains(delegateFunc)) | ||
893 | CanCopyInventoryCheckFunctions.Remove(delegateFunc); | ||
894 | } | ||
895 | |||
896 | public bool ExternalChecksCanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID) | ||
897 | { | ||
898 | foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions) | ||
899 | { | ||
900 | if (check(itemID, objectID, userID) == false) | ||
901 | { | ||
902 | return false; | ||
903 | } | ||
904 | } | ||
905 | return true; | ||
906 | } | ||
907 | |||
908 | public delegate bool CanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID); | ||
909 | private List<CanDeleteInventory> CanDeleteInventoryCheckFunctions = new List<CanDeleteInventory>(); | ||
910 | |||
911 | public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc) | ||
912 | { | ||
913 | if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) | ||
914 | CanDeleteInventoryCheckFunctions.Add(delegateFunc); | ||
915 | } | ||
916 | public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc) | ||
917 | { | ||
918 | if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc)) | ||
919 | CanDeleteInventoryCheckFunctions.Remove(delegateFunc); | ||
920 | } | ||
921 | |||
922 | public bool ExternalChecksCanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID) | ||
923 | { | ||
924 | foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions) | ||
925 | { | ||
926 | if (check(itemID, objectID, userID) == false) | ||
927 | { | ||
928 | return false; | ||
929 | } | ||
930 | } | ||
931 | return true; | ||
932 | } | ||
933 | |||
934 | public delegate bool CanTeleport(LLUUID userID); | ||
935 | private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>(); | ||
936 | |||
937 | public void addCheckCanTeleport(CanTeleport delegateFunc) | ||
938 | { | ||
939 | if (!CanTeleportCheckFunctions.Contains(delegateFunc)) | ||
940 | CanTeleportCheckFunctions.Add(delegateFunc); | ||
941 | } | ||
942 | public void removeCheckCanTeleport(CanTeleport delegateFunc) | ||
943 | { | ||
944 | if (CanTeleportCheckFunctions.Contains(delegateFunc)) | ||
945 | CanTeleportCheckFunctions.Remove(delegateFunc); | ||
946 | } | ||
947 | |||
948 | public bool ExternalChecksCanTeleport(LLUUID userID) | ||
949 | { | ||
950 | foreach (CanTeleport check in CanTeleportCheckFunctions) | ||
951 | { | ||
952 | if (check(userID) == false) | ||
953 | { | ||
954 | return false; | ||
955 | } | ||
956 | } | ||
957 | return true; | ||
958 | } | ||
727 | } | 959 | } |
728 | } | 960 | } |
729 | 961 | ||