aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-03-12 23:54:20 +0000
committerJustin Clark-Casey (justincc)2014-03-12 23:54:20 +0000
commit6a279feb2fdd9f85876b6533fed1020fdbffc20a (patch)
tree4b5afa819a8b7ee32a4e8db95eab9dce61082d0d /OpenSim/Region
parentImplement osForceCreateLink() and osForceBreakLink() (diff)
downloadopensim-SC-6a279feb2fdd9f85876b6533fed1020fdbffc20a.zip
opensim-SC-6a279feb2fdd9f85876b6533fed1020fdbffc20a.tar.gz
opensim-SC-6a279feb2fdd9f85876b6533fed1020fdbffc20a.tar.bz2
opensim-SC-6a279feb2fdd9f85876b6533fed1020fdbffc20a.tar.xz
Only allow llBreakAllLinks() to work if script has received PERMISSION_CHANGE_LINKS
As per http://wiki.secondlife.com/wiki/LlBreakAllLinks Same as existing llCreateLink() and llBreakLink()
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs42
2 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 45a7c96..abd8123 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3922,6 +3922,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3922 public void llBreakAllLinks() 3922 public void llBreakAllLinks()
3923 { 3923 {
3924 m_host.AddScriptLPS(1); 3924 m_host.AddScriptLPS(1);
3925
3926 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3927 && !m_automaticLinkPermission)
3928 {
3929 Error("llBreakAllLinks", "PERMISSION_CHANGE_LINKS permission not set");
3930 return;
3931 }
3932
3925 SceneObjectGroup parentPrim = m_host.ParentGroup; 3933 SceneObjectGroup parentPrim = m_host.ParentGroup;
3926 if (parentPrim.AttachmentPoint != 0) 3934 if (parentPrim.AttachmentPoint != 0)
3927 return; // Fail silently if attached 3935 return; // Fail silently if attached
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index ac9f93b..4c5a501 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -141,5 +141,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
141 SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1"); 141 SceneObjectGroup grp2 = m_scene.GetSceneObjectGroup("grp1-Part1");
142 Assert.That(grp2, Is.Not.Null); 142 Assert.That(grp2, Is.Not.Null);
143 } 143 }
144
145 [Test]
146 public void TestllBreakAllLinks()
147 {
148 TestHelpers.InMethod();
149
150 UUID ownerId = TestHelpers.ParseTail(0x1);
151
152 SceneObjectGroup grp1 = SceneHelpers.CreateSceneObject(3, ownerId, "grp1-", 0x10);
153 grp1.AbsolutePosition = new Vector3(10, 10, 10);
154 m_scene.AddSceneObject(grp1);
155
156 // FIXME: This should really be a script item (with accompanying script)
157 TaskInventoryItem grp1Item
158 = TaskInventoryHelpers.AddNotecard(
159 m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
160
161 grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
162
163 LSL_Api apiGrp1 = new LSL_Api();
164 apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
165
166 apiGrp1.llBreakAllLinks();
167
168 {
169 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part1");
170 Assert.That(nowGrp, Is.Not.Null);
171 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
172 }
173
174 {
175 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part2");
176 Assert.That(nowGrp, Is.Not.Null);
177 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
178 }
179
180 {
181 SceneObjectGroup nowGrp = m_scene.GetSceneObjectGroup("grp1-Part3");
182 Assert.That(nowGrp, Is.Not.Null);
183 Assert.That(nowGrp.Parts.Length, Is.EqualTo(1));
184 }
185 }
144 } 186 }
145} \ No newline at end of file 187} \ No newline at end of file