diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 53 |
1 files changed, 45 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) |