diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9a01025270..4da0076bae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; internal float m_ScriptDelayFactor = 1.0f; internal float m_ScriptDistanceFactor = 1.0f; - internal Dictionary m_FunctionPerms = new Dictionary(); + internal Dictionary > m_FunctionPerms = new Dictionary >(); public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) { @@ -184,15 +184,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!m_FunctionPerms.ContainsKey(function)) { - m_FunctionPerms[function] = - m_ScriptEngine.Config.GetBoolean("Allow_"+function, true); + string perm = m_ScriptEngine.Config.GetString("Allow_"+function, "true"); + bool allowed; + + if (bool.TryParse(perm, out allowed)) + { + // Boolean given + if(allowed) + m_FunctionPerms[function] = null; // a null value is all + else + m_FunctionPerms[function] = new List(); // Empty list = none + } + else + { + m_FunctionPerms[function] = new List(); + + string[] ids = perm.Split(new char[] {','}); + foreach (string id in ids) + { + string current = id.Trim(); + UUID uuid; + + if (UUID.TryParse(current, out uuid)) + { + m_FunctionPerms[function].Add(uuid); + } + } + } } - if (!m_FunctionPerms[function]) - return; - - if (level > m_MaxThreatLevel) - throw new Exception("Threat level too high - "+function); + // If the list is null, then the value was true / undefined + // Threat level governs permissions in this case + // + // If the list is non-null, then it is a list of UUIDs allowed + // to use that particular function. False causes an empty + // list and therefore means "no one" + // + if (m_FunctionPerms[function] == null) // No list = true + { + if (level > m_MaxThreatLevel) + throw new Exception("Threat level too high - "+function); + } + else + { + if (!m_FunctionPerms[function].Contains(m_host.OwnerID)) + throw new Exception("Threat level too high - "+function); + } } protected void ScriptSleep(int delay) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 617f10eb3f..25a233e8bb 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -692,6 +692,17 @@ ScriptDelayFactor = 1.0 ; The factor the 10 m distances llimits are multiplied by ScriptDistanceLimitFactor = 1.0 +; OS Functions enable/disable +; For each function, you can add one line, as shown + +; true is the default for all functions, and allows them if below threat level +; Allow_osSetRegionWaterHeight = true + +; false disables the function completely +; Allow_osSetRegionWaterHeight = false + +; Comma separated list of UUIDS allows the function for that list of UUIDS +; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb [GridInfo]