diff options
author | idb | 2008-12-21 13:28:51 +0000 |
---|---|---|
committer | idb | 2008-12-21 13:28:51 +0000 |
commit | d7a19adcac21e2c19d01755de803d5210d4821ea (patch) | |
tree | 59a3e35c38164ed5c0656b04ab775cc09fe1b6c3 /OpenSim/Region/ScriptEngine/Shared | |
parent | Small null check in DeregisterHandlers. (diff) | |
download | opensim-SC_OLD-d7a19adcac21e2c19d01755de803d5210d4821ea.zip opensim-SC_OLD-d7a19adcac21e2c19d01755de803d5210d4821ea.tar.gz opensim-SC_OLD-d7a19adcac21e2c19d01755de803d5210d4821ea.tar.bz2 opensim-SC_OLD-d7a19adcac21e2c19d01755de803d5210d4821ea.tar.xz |
Persist script permission mask and granter
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs | 38 |
2 files changed, 50 insertions, 0 deletions
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 | |||
83 | private int m_ControlEventsInQueue = 0; | 83 | private int m_ControlEventsInQueue = 0; |
84 | private int m_LastControlLevel = 0; | 84 | private int m_LastControlLevel = 0; |
85 | private bool m_CollisionInQueue = false; | 85 | private bool m_CollisionInQueue = false; |
86 | private TaskInventoryItem m_thisScriptTask; | ||
87 | |||
86 | //private ISponsor m_ScriptSponsor; | 88 | //private ISponsor m_ScriptSponsor; |
87 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> | 89 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> |
88 | m_LineMap; | 90 | m_LineMap; |
@@ -177,6 +179,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
177 | set { m_StartParam = value; } | 179 | set { m_StartParam = value; } |
178 | } | 180 | } |
179 | 181 | ||
182 | public TaskInventoryItem ScriptTask | ||
183 | { | ||
184 | get { return m_thisScriptTask; } | ||
185 | } | ||
186 | |||
180 | public ScriptInstance(IScriptEngine engine, SceneObjectPart part, | 187 | public ScriptInstance(IScriptEngine engine, SceneObjectPart part, |
181 | UUID itemID, UUID assetID, string assembly, | 188 | UUID itemID, UUID assetID, string assembly, |
182 | AppDomain dom, string primName, string scriptName, | 189 | AppDomain dom, string primName, string scriptName, |
@@ -195,6 +202,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
195 | m_StartParam = startParam; | 202 | m_StartParam = startParam; |
196 | m_MaxScriptQueue = maxScriptQueue; | 203 | m_MaxScriptQueue = maxScriptQueue; |
197 | 204 | ||
205 | if (part != null && part.TaskInventory.ContainsKey(m_ItemID)) | ||
206 | { | ||
207 | m_thisScriptTask = part.TaskInventory[m_ItemID]; | ||
208 | } | ||
209 | |||
198 | ApiManager am = new ApiManager(); | 210 | ApiManager am = new ApiManager(); |
199 | 211 | ||
200 | foreach (string api in am.GetApis()) | 212 | 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 | |||
179 | 179 | ||
180 | rootElement.AppendChild(plugins); | 180 | rootElement.AppendChild(plugins); |
181 | 181 | ||
182 | if (instance.ScriptTask != null) | ||
183 | { | ||
184 | if (instance.ScriptTask.PermsMask != 0 && instance.ScriptTask.PermsGranter != UUID.Zero) | ||
185 | { | ||
186 | XmlNode permissions = xmldoc.CreateElement("", "Permissions", ""); | ||
187 | XmlAttribute granter = xmldoc.CreateAttribute("", "granter", ""); | ||
188 | granter.Value = instance.ScriptTask.PermsGranter.ToString(); | ||
189 | permissions.Attributes.Append(granter); | ||
190 | XmlAttribute mask = xmldoc.CreateAttribute("", "mask", ""); | ||
191 | mask.Value = instance.ScriptTask.PermsMask.ToString(); | ||
192 | permissions.Attributes.Append(mask); | ||
193 | rootElement.AppendChild(permissions); | ||
194 | } | ||
195 | } | ||
196 | |||
182 | return xmldoc.InnerXml; | 197 | return xmldoc.InnerXml; |
183 | } | 198 | } |
184 | 199 | ||
@@ -342,6 +357,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
342 | case "Plugins": | 357 | case "Plugins": |
343 | instance.PluginData = ReadList(part).Data; | 358 | instance.PluginData = ReadList(part).Data; |
344 | break; | 359 | break; |
360 | case "Permissions": | ||
361 | string tmpPerm; | ||
362 | int mask = 0; | ||
363 | tmpPerm = part.Attributes.GetNamedItem("mask").Value; | ||
364 | if (tmpPerm != null) | ||
365 | { | ||
366 | int.TryParse(tmpPerm, out mask); | ||
367 | if (mask != 0) | ||
368 | { | ||
369 | tmpPerm = part.Attributes.GetNamedItem("granter").Value; | ||
370 | if (tmpPerm != null) | ||
371 | { | ||
372 | UUID granter = new UUID(); | ||
373 | UUID.TryParse(tmpPerm, out granter); | ||
374 | if (granter != UUID.Zero) | ||
375 | { | ||
376 | instance.ScriptTask.PermsMask = mask; | ||
377 | instance.ScriptTask.PermsGranter = granter; | ||
378 | } | ||
379 | } | ||
380 | } | ||
381 | } | ||
382 | break; | ||
345 | } | 383 | } |
346 | } | 384 | } |
347 | } | 385 | } |