Persist script permission mask and granter

0.6.2-post-fixes
idb 2008-12-21 13:28:51 +00:00
parent 9af9f648ef
commit d7a19adcac
2 changed files with 50 additions and 0 deletions

View File

@ -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<int, int>, KeyValuePair<int, int>>
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())

View File

@ -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;
}
}
}