diff options
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 52 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 3 |
2 files changed, 36 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 72a8dc5..f010f7d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -187,30 +187,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
187 | 187 | ||
188 | if (!m_FunctionPerms.ContainsKey(function)) | 188 | if (!m_FunctionPerms.ContainsKey(function)) |
189 | { | 189 | { |
190 | string perm = m_ScriptEngine.Config.GetString("Allow_"+function, "true"); | 190 | string perm = m_ScriptEngine.Config.GetString("Allow_"+function, ""); |
191 | bool allowed; | 191 | if (perm == "") |
192 | |||
193 | if (bool.TryParse(perm, out allowed)) | ||
194 | { | 192 | { |
195 | // Boolean given | 193 | m_FunctionPerms[function] = null; // a null value is default |
196 | if (allowed) | ||
197 | m_FunctionPerms[function] = null; // a null value is all | ||
198 | else | ||
199 | m_FunctionPerms[function] = new List<UUID>(); // Empty list = none | ||
200 | } | 194 | } |
201 | else | 195 | else |
202 | { | 196 | { |
203 | m_FunctionPerms[function] = new List<UUID>(); | 197 | bool allowed; |
204 | 198 | ||
205 | string[] ids = perm.Split(new char[] {','}); | 199 | if (bool.TryParse(perm, out allowed)) |
206 | foreach (string id in ids) | 200 | { |
201 | // Boolean given | ||
202 | if (allowed) | ||
203 | { | ||
204 | m_FunctionPerms[function] = new List<UUID>(); | ||
205 | m_FunctionPerms[function].Add(UUID.Zero); | ||
206 | } | ||
207 | else | ||
208 | m_FunctionPerms[function] = new List<UUID>(); // Empty list = none | ||
209 | } | ||
210 | else | ||
207 | { | 211 | { |
208 | string current = id.Trim(); | 212 | m_FunctionPerms[function] = new List<UUID>(); |
209 | UUID uuid; | ||
210 | 213 | ||
211 | if (UUID.TryParse(current, out uuid)) | 214 | string[] ids = perm.Split(new char[] {','}); |
215 | foreach (string id in ids) | ||
212 | { | 216 | { |
213 | m_FunctionPerms[function].Add(uuid); | 217 | string current = id.Trim(); |
218 | UUID uuid; | ||
219 | |||
220 | if (UUID.TryParse(current, out uuid)) | ||
221 | { | ||
222 | if (uuid != uuid.Zero) | ||
223 | m_FunctionPerms[function].Add(uuid); | ||
224 | } | ||
214 | } | 225 | } |
215 | } | 226 | } |
216 | } | 227 | } |
@@ -223,6 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
223 | // to use that particular function. False causes an empty | 234 | // to use that particular function. False causes an empty |
224 | // list and therefore means "no one" | 235 | // list and therefore means "no one" |
225 | // | 236 | // |
237 | // To allow use by anyone, the list contains UUID.Zero | ||
238 | // | ||
226 | if (m_FunctionPerms[function] == null) // No list = true | 239 | if (m_FunctionPerms[function] == null) // No list = true |
227 | { | 240 | { |
228 | if (level > m_MaxThreatLevel) | 241 | if (level > m_MaxThreatLevel) |
@@ -230,8 +243,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
230 | } | 243 | } |
231 | else | 244 | else |
232 | { | 245 | { |
233 | if (!m_FunctionPerms[function].Contains(m_host.OwnerID)) | 246 | if (!m_FunctionPerms[function].Contains(UUID.Zero)) |
234 | throw new Exception("Threat level too high - "+function); | 247 | { |
248 | if (!m_FunctionPerms[function].Contains(m_host.OwnerID)) | ||
249 | throw new Exception("Threat level too high - "+function); | ||
250 | } | ||
235 | } | 251 | } |
236 | } | 252 | } |
237 | 253 | ||
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 1464bee..cee8da0 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -835,8 +835,9 @@ | |||
835 | 835 | ||
836 | ; OS Functions enable/disable | 836 | ; OS Functions enable/disable |
837 | ; For each function, you can add one line, as shown | 837 | ; For each function, you can add one line, as shown |
838 | ; The default for all functions allows them if below threat level | ||
838 | 839 | ||
839 | ; true is the default for all functions, and allows them if below threat level | 840 | ; true allows the use of the function unconditionally |
840 | ; Allow_osSetRegionWaterHeight = true | 841 | ; Allow_osSetRegionWaterHeight = true |
841 | 842 | ||
842 | ; false disables the function completely | 843 | ; false disables the function completely |