diff options
author | Justin Clark-Casey (justincc) | 2014-03-12 23:05:16 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-12 23:05:16 +0000 |
commit | 296d63e20b0b77ba70257726ae519ef733865534 (patch) | |
tree | ccb78b6140f8f19cbe1d933e1891f26db0587c0d | |
parent | When sending group notices through group messaging, allow the agent ID to use... (diff) | |
download | opensim-SC-296d63e20b0b77ba70257726ae519ef733865534.zip opensim-SC-296d63e20b0b77ba70257726ae519ef733865534.tar.gz opensim-SC-296d63e20b0b77ba70257726ae519ef733865534.tar.bz2 opensim-SC-296d63e20b0b77ba70257726ae519ef733865534.tar.xz |
Implement osForceCreateLink() and osForceBreakLink()
These are identical to llCreateLink() and llBreakLink() except that they don't require script permissions.
However, osForceCreateLink() still requires that linked and linkee still have the same owner.
There's also an AutomaticLinkPermission setting in [XEngine] that could be set to true to prevent the LSL function checks.
But this doesn't allow the finer control over which users/scripts, etc. can do this that the OSSL functions provide.
4 files changed, 62 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b333b55..45a7c96 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3769,10 +3769,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3769 | public void llCreateLink(string target, int parent) | 3769 | public void llCreateLink(string target, int parent) |
3770 | { | 3770 | { |
3771 | m_host.AddScriptLPS(1); | 3771 | m_host.AddScriptLPS(1); |
3772 | UUID targetID; | ||
3773 | |||
3774 | if (!UUID.TryParse(target, out targetID)) | ||
3775 | return; | ||
3776 | 3772 | ||
3777 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 | 3773 | if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 |
3778 | && !m_automaticLinkPermission) | 3774 | && !m_automaticLinkPermission) |
@@ -3781,10 +3777,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3781 | return; | 3777 | return; |
3782 | } | 3778 | } |
3783 | 3779 | ||
3784 | IClientAPI client = null; | 3780 | CreateLink(target, parent); |
3785 | ScenePresence sp = World.GetScenePresence(m_item.PermsGranter); | 3781 | } |
3786 | if (sp != null) | 3782 | |
3787 | client = sp.ControllingClient; | 3783 | public void CreateLink(string target, int parent) |
3784 | { | ||
3785 | UUID targetID; | ||
3786 | |||
3787 | if (!UUID.TryParse(target, out targetID)) | ||
3788 | return; | ||
3788 | 3789 | ||
3789 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); | 3790 | SceneObjectPart targetPart = World.GetSceneObjectPart((UUID)targetID); |
3790 | 3791 | ||
@@ -3819,6 +3820,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3819 | parentPrim.HasGroupChanged = true; | 3820 | parentPrim.HasGroupChanged = true; |
3820 | parentPrim.ScheduleGroupForFullUpdate(); | 3821 | parentPrim.ScheduleGroupForFullUpdate(); |
3821 | 3822 | ||
3823 | IClientAPI client = null; | ||
3824 | ScenePresence sp = World.GetScenePresence(m_host.OwnerID); | ||
3825 | if (sp != null) | ||
3826 | client = sp.ControllingClient; | ||
3827 | |||
3822 | if (client != null) | 3828 | if (client != null) |
3823 | parentPrim.SendPropertiesToClient(client); | 3829 | parentPrim.SendPropertiesToClient(client); |
3824 | 3830 | ||
@@ -3836,6 +3842,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3836 | return; | 3842 | return; |
3837 | } | 3843 | } |
3838 | 3844 | ||
3845 | BreakLink(linknum); | ||
3846 | } | ||
3847 | |||
3848 | public void BreakLink(int linknum) | ||
3849 | { | ||
3839 | if (linknum < ScriptBaseClass.LINK_THIS) | 3850 | if (linknum < ScriptBaseClass.LINK_THIS) |
3840 | return; | 3851 | return; |
3841 | 3852 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4cd683c..cfc48e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2330,6 +2330,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2330 | return retVal; | 2330 | return retVal; |
2331 | } | 2331 | } |
2332 | 2332 | ||
2333 | public void osForceCreateLink(string target, int parent) | ||
2334 | { | ||
2335 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceCreateLink"); | ||
2336 | |||
2337 | m_host.AddScriptLPS(1); | ||
2338 | |||
2339 | InitLSL(); | ||
2340 | ((LSL_Api)m_LSL_Api).CreateLink(target, parent); | ||
2341 | } | ||
2342 | |||
2343 | public void osForceBreakLink(int linknum) | ||
2344 | { | ||
2345 | CheckThreatLevel(ThreatLevel.VeryLow, "osForceBreakLink"); | ||
2346 | |||
2347 | m_host.AddScriptLPS(1); | ||
2348 | |||
2349 | InitLSL(); | ||
2350 | ((LSL_Api)m_LSL_Api).BreakLink(linknum); | ||
2351 | } | ||
2352 | |||
2333 | public LSL_Integer osIsNpc(LSL_Key npc) | 2353 | public LSL_Integer osIsNpc(LSL_Key npc) |
2334 | { | 2354 | { |
2335 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); | 2355 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 519779e..b5de355 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -294,6 +294,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
294 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); | 294 | LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// Identical to llCreateLink() but does not require permission from the owner. | ||
298 | /// </summary> | ||
299 | /// <param name='target'></param> | ||
300 | /// <param name='parent'></param> | ||
301 | void osForceCreateLink(string target, int parent); | ||
302 | |||
303 | /// <summary> | ||
304 | /// Identical to llBreakLink() but does not require permission from the owner. | ||
305 | /// </summary> | ||
306 | /// <param name='linknum'></param> | ||
307 | void osForceBreakLink(int linknum); | ||
308 | |||
309 | /// <summary> | ||
297 | /// Check if the given key is an npc | 310 | /// Check if the given key is an npc |
298 | /// </summary> | 311 | /// </summary> |
299 | /// <param name="npc"></param> | 312 | /// <param name="npc"></param> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 9c060e5..7d5e568 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -542,6 +542,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
542 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); | 542 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); |
543 | } | 543 | } |
544 | 544 | ||
545 | public void osForceCreateLink(string target, int parent) | ||
546 | { | ||
547 | m_OSSL_Functions.osForceCreateLink(target, parent); | ||
548 | } | ||
549 | |||
550 | public void osForceBreakLink(int linknum) | ||
551 | { | ||
552 | m_OSSL_Functions.osForceBreakLink(linknum); | ||
553 | } | ||
554 | |||
545 | public LSL_Integer osIsNpc(LSL_Key npc) | 555 | public LSL_Integer osIsNpc(LSL_Key npc) |
546 | { | 556 | { |
547 | return m_OSSL_Functions.osIsNpc(npc); | 557 | return m_OSSL_Functions.osIsNpc(npc); |