From d7a19adcac21e2c19d01755de803d5210d4821ea Mon Sep 17 00:00:00 2001 From: idb Date: Sun, 21 Dec 2008 13:28:51 +0000 Subject: Persist script permission mask and granter --- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 12 +++++++ .../Shared/Instance/ScriptSerializer.cs | 38 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index cd128a9..1f57c13 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -83,6 +83,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance private int m_ControlEventsInQueue = 0; private int m_LastControlLevel = 0; private bool m_CollisionInQueue = false; + private TaskInventoryItem m_thisScriptTask; + //private ISponsor m_ScriptSponsor; private Dictionary, KeyValuePair> m_LineMap; @@ -177,6 +179,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance set { m_StartParam = value; } } + public TaskInventoryItem ScriptTask + { + get { return m_thisScriptTask; } + } + public ScriptInstance(IScriptEngine engine, SceneObjectPart part, UUID itemID, UUID assetID, string assembly, AppDomain dom, string primName, string scriptName, @@ -195,6 +202,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance m_StartParam = startParam; m_MaxScriptQueue = maxScriptQueue; + if (part != null && part.TaskInventory.ContainsKey(m_ItemID)) + { + m_thisScriptTask = part.TaskInventory[m_ItemID]; + } + ApiManager am = new ApiManager(); foreach (string api in am.GetApis()) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs index 17a864d..0ec039b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs @@ -179,6 +179,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance rootElement.AppendChild(plugins); + if (instance.ScriptTask != null) + { + if (instance.ScriptTask.PermsMask != 0 && instance.ScriptTask.PermsGranter != UUID.Zero) + { + XmlNode permissions = xmldoc.CreateElement("", "Permissions", ""); + XmlAttribute granter = xmldoc.CreateAttribute("", "granter", ""); + granter.Value = instance.ScriptTask.PermsGranter.ToString(); + permissions.Attributes.Append(granter); + XmlAttribute mask = xmldoc.CreateAttribute("", "mask", ""); + mask.Value = instance.ScriptTask.PermsMask.ToString(); + permissions.Attributes.Append(mask); + rootElement.AppendChild(permissions); + } + } + return xmldoc.InnerXml; } @@ -342,6 +357,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance case "Plugins": instance.PluginData = ReadList(part).Data; break; + case "Permissions": + string tmpPerm; + int mask = 0; + tmpPerm = part.Attributes.GetNamedItem("mask").Value; + if (tmpPerm != null) + { + int.TryParse(tmpPerm, out mask); + if (mask != 0) + { + tmpPerm = part.Attributes.GetNamedItem("granter").Value; + if (tmpPerm != null) + { + UUID granter = new UUID(); + UUID.TryParse(tmpPerm, out granter); + if (granter != UUID.Zero) + { + instance.ScriptTask.PermsMask = mask; + instance.ScriptTask.PermsGranter = granter; + } + } + } + } + break; } } } -- cgit v1.1