diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 |
2 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 6925b6c..e941210 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
60 | public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); | 60 | public delegate bool ViewNotecardHandler(UUID script, UUID objectID, UUID user, Scene scene); |
61 | public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); | 61 | public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); |
62 | public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); | 62 | public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); |
63 | public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); | 63 | public delegate bool RunScriptHandlerByIDs(UUID script, UUID objectID, UUID user, Scene scene); |
64 | public delegate bool RunScriptHandler(TaskInventoryItem item, SceneObjectPart part); | ||
64 | public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); | 65 | public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene); |
65 | public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); | 66 | public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); |
66 | public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); | 67 | public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); |
@@ -131,6 +132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
131 | public event ViewNotecardHandler OnViewNotecard; | 132 | public event ViewNotecardHandler OnViewNotecard; |
132 | public event EditScriptHandler OnEditScript; | 133 | public event EditScriptHandler OnEditScript; |
133 | public event EditNotecardHandler OnEditNotecard; | 134 | public event EditNotecardHandler OnEditNotecard; |
135 | public event RunScriptHandlerByIDs OnRunScriptByIDs; | ||
134 | public event RunScriptHandler OnRunScript; | 136 | public event RunScriptHandler OnRunScript; |
135 | public event CompileScriptHandler OnCompileScript; | 137 | public event CompileScriptHandler OnCompileScript; |
136 | public event StartScriptHandler OnStartScript; | 138 | public event StartScriptHandler OnStartScript; |
@@ -654,19 +656,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
654 | #region RUN SCRIPT (When Script Placed in Object) | 656 | #region RUN SCRIPT (When Script Placed in Object) |
655 | public bool CanRunScript(UUID script, UUID objectID, UUID user) | 657 | public bool CanRunScript(UUID script, UUID objectID, UUID user) |
656 | { | 658 | { |
659 | RunScriptHandlerByIDs handler = OnRunScriptByIDs; | ||
660 | if (handler != null) | ||
661 | { | ||
662 | Delegate[] list = handler.GetInvocationList(); | ||
663 | foreach (RunScriptHandlerByIDs h in list) | ||
664 | { | ||
665 | if (h(script, objectID, user, m_scene) == false) | ||
666 | return false; | ||
667 | } | ||
668 | } | ||
669 | return true; | ||
670 | } | ||
671 | |||
672 | public bool CanRunScript(TaskInventoryItem item, SceneObjectPart part) | ||
673 | { | ||
657 | RunScriptHandler handler = OnRunScript; | 674 | RunScriptHandler handler = OnRunScript; |
658 | if (handler != null) | 675 | if (handler != null) |
659 | { | 676 | { |
677 | if(item == null || part == null) | ||
678 | return false; | ||
660 | Delegate[] list = handler.GetInvocationList(); | 679 | Delegate[] list = handler.GetInvocationList(); |
661 | foreach (RunScriptHandler h in list) | 680 | foreach (RunScriptHandler h in list) |
662 | { | 681 | { |
663 | if (h(script, objectID, user, m_scene) == false) | 682 | if (h(item, part) == false) |
664 | return false; | 683 | return false; |
665 | } | 684 | } |
666 | } | 685 | } |
667 | return true; | 686 | return true; |
668 | } | 687 | } |
669 | 688 | ||
689 | |||
670 | #endregion | 690 | #endregion |
671 | 691 | ||
672 | #region COMPILE SCRIPT (When Script needs to get (re)compiled) | 692 | #region COMPILE SCRIPT (When Script needs to get (re)compiled) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 545d44b..b53c355 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", | 360 | // m_log.DebugFormat("[PRIM INVENTORY]: Starting script {0} {1} in prim {2} {3} in {4}", |
361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 361 | // item.Name, item.ItemID, m_part.Name, m_part.UUID, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
362 | 362 | ||
363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 363 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item, m_part)) |
364 | { | 364 | { |
365 | StoreScriptError(item.ItemID, "no permission"); | 365 | StoreScriptError(item.ItemID, "no permission"); |
366 | return false; | 366 | return false; |