diff options
author | Melanie Thielker | 2008-09-15 23:50:07 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-09-15 23:50:07 +0000 |
commit | ae63b2d2caf39fa8db3bb877a8d78f3d394c8f5d (patch) | |
tree | 1dc43ea4c31a3a39181d4b8aab3778dc1323a970 | |
parent | Refactor the os functions allowed check into the threat check method (diff) | |
download | opensim-SC_OLD-ae63b2d2caf39fa8db3bb877a8d78f3d394c8f5d.zip opensim-SC_OLD-ae63b2d2caf39fa8db3bb877a8d78f3d394c8f5d.tar.gz opensim-SC_OLD-ae63b2d2caf39fa8db3bb877a8d78f3d394c8f5d.tar.bz2 opensim-SC_OLD-ae63b2d2caf39fa8db3bb877a8d78f3d394c8f5d.tar.xz |
Finish up OSSL enable/disable options in XEngine.
Now each function can be allowed, subject to threat level, disabled,
or restricted to certain UUIDs.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 53 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 11 |
2 files changed, 56 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9a01025..4da0076 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 | |||
107 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; | 107 | internal ThreatLevel m_MaxThreatLevel = ThreatLevel.VeryLow; |
108 | internal float m_ScriptDelayFactor = 1.0f; | 108 | internal float m_ScriptDelayFactor = 1.0f; |
109 | internal float m_ScriptDistanceFactor = 1.0f; | 109 | internal float m_ScriptDistanceFactor = 1.0f; |
110 | internal Dictionary<string, bool> m_FunctionPerms = new Dictionary<string, bool>(); | 110 | internal Dictionary<string, List<UUID> > m_FunctionPerms = new Dictionary<string, List<UUID> >(); |
111 | 111 | ||
112 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 112 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
113 | { | 113 | { |
@@ -184,15 +184,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
184 | 184 | ||
185 | if (!m_FunctionPerms.ContainsKey(function)) | 185 | if (!m_FunctionPerms.ContainsKey(function)) |
186 | { | 186 | { |
187 | m_FunctionPerms[function] = | 187 | string perm = m_ScriptEngine.Config.GetString("Allow_"+function, "true"); |
188 | m_ScriptEngine.Config.GetBoolean("Allow_"+function, true); | 188 | bool allowed; |
189 | } | ||
190 | 189 | ||
191 | if (!m_FunctionPerms[function]) | 190 | if (bool.TryParse(perm, out allowed)) |
192 | return; | 191 | { |
192 | // Boolean given | ||
193 | if(allowed) | ||
194 | m_FunctionPerms[function] = null; // a null value is all | ||
195 | else | ||
196 | m_FunctionPerms[function] = new List<UUID>(); // Empty list = none | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | m_FunctionPerms[function] = new List<UUID>(); | ||
201 | |||
202 | string[] ids = perm.Split(new char[] {','}); | ||
203 | foreach (string id in ids) | ||
204 | { | ||
205 | string current = id.Trim(); | ||
206 | UUID uuid; | ||
207 | |||
208 | if (UUID.TryParse(current, out uuid)) | ||
209 | { | ||
210 | m_FunctionPerms[function].Add(uuid); | ||
211 | } | ||
212 | } | ||
213 | } | ||
214 | } | ||
193 | 215 | ||
194 | if (level > m_MaxThreatLevel) | 216 | // If the list is null, then the value was true / undefined |
195 | throw new Exception("Threat level too high - "+function); | 217 | // Threat level governs permissions in this case |
218 | // | ||
219 | // If the list is non-null, then it is a list of UUIDs allowed | ||
220 | // to use that particular function. False causes an empty | ||
221 | // list and therefore means "no one" | ||
222 | // | ||
223 | if (m_FunctionPerms[function] == null) // No list = true | ||
224 | { | ||
225 | if (level > m_MaxThreatLevel) | ||
226 | throw new Exception("Threat level too high - "+function); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | if (!m_FunctionPerms[function].Contains(m_host.OwnerID)) | ||
231 | throw new Exception("Threat level too high - "+function); | ||
232 | } | ||
196 | } | 233 | } |
197 | 234 | ||
198 | protected void ScriptSleep(int delay) | 235 | protected void ScriptSleep(int delay) |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 617f10e..25a233e 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -692,6 +692,17 @@ ScriptDelayFactor = 1.0 | |||
692 | ; The factor the 10 m distances llimits are multiplied by | 692 | ; The factor the 10 m distances llimits are multiplied by |
693 | ScriptDistanceLimitFactor = 1.0 | 693 | ScriptDistanceLimitFactor = 1.0 |
694 | 694 | ||
695 | ; OS Functions enable/disable | ||
696 | ; For each function, you can add one line, as shown | ||
697 | |||
698 | ; true is the default for all functions, and allows them if below threat level | ||
699 | ; Allow_osSetRegionWaterHeight = true | ||
700 | |||
701 | ; false disables the function completely | ||
702 | ; Allow_osSetRegionWaterHeight = false | ||
703 | |||
704 | ; Comma separated list of UUIDS allows the function for that list of UUIDS | ||
705 | ; Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb | ||
695 | 706 | ||
696 | [GridInfo] | 707 | [GridInfo] |
697 | 708 | ||