aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
6 files changed, 102 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 6b46176..9298380 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -87,6 +87,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
87 /// permissions are not being bypassed. This overrides normal permissions.- 87 /// permissions are not being bypassed. This overrides normal permissions.-
88 /// </value> 88 /// </value>
89 private UserSet m_allowedScriptEditors = UserSet.All; 89 private UserSet m_allowedScriptEditors = UserSet.All;
90
91 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>();
92 private Dictionary<string, bool> GrantCS = new Dictionary<string, bool>();
93 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
94 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
90 95
91 #endregion 96 #endregion
92 97
@@ -143,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
143 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED 148 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED
144 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; 149 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
145 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED 150 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED
151 m_scene.Permissions.OnCompileScript += CanCompileScript;
146 m_scene.Permissions.OnSellParcel += CanSellParcel; 152 m_scene.Permissions.OnSellParcel += CanSellParcel;
147 m_scene.Permissions.OnTakeObject += CanTakeObject; 153 m_scene.Permissions.OnTakeObject += CanTakeObject;
148 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; 154 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
@@ -184,6 +190,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
184 "debug permissions <true / false>", 190 "debug permissions <true / false>",
185 "Enable permissions debugging", 191 "Enable permissions debugging",
186 HandleDebugPermissions); 192 HandleDebugPermissions);
193
194
195 string grant = myConfig.GetString("GrantLSL","");
196 if(grant.Length > 0) {
197 foreach (string uuidl in grant.Split(',')) {
198 string uuid = uuidl.Trim(" \t".ToCharArray());
199 GrantLSL.Add(uuid, true);
200 }
201 }
202
203 grant = myConfig.GetString("GrantCS","");
204 if(grant.Length > 0) {
205 foreach (string uuidl in grant.Split(',')) {
206 string uuid = uuidl.Trim(" \t".ToCharArray());
207 GrantCS.Add(uuid, true);
208 }
209 }
210
211 grant = myConfig.GetString("GrantVB","");
212 if(grant.Length > 0) {
213 foreach (string uuidl in grant.Split(',')) {
214 string uuid = uuidl.Trim(" \t".ToCharArray());
215 GrantVB.Add(uuid, true);
216 }
217 }
218
219 grant = myConfig.GetString("GrantJS","");
220 if(grant.Length > 0) {
221 foreach (string uuidl in grant.Split(',')) {
222 string uuid = uuidl.Trim(" \t".ToCharArray());
223 GrantJS.Add(uuid, true);
224 }
225 }
226
187 } 227 }
188 228
189 public void HandleBypassPermissions(string module, string[] args) 229 public void HandleBypassPermissions(string module, string[] args)
@@ -1584,5 +1624,34 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1584 1624
1585 return GenericParcelPermission(client.AgentId, parcel); 1625 return GenericParcelPermission(client.AgentId, parcel);
1586 } 1626 }
1627
1628 private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) {
1629 //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
1630 switch(scriptType) {
1631 case 0:
1632 if(GrantLSL.Count == 0 || GrantLSL.ContainsKey(ownerUUID.ToString())) {
1633 return(true);
1634 }
1635 break;
1636 case 1:
1637 if(GrantCS.Count == 0 || GrantCS.ContainsKey(ownerUUID.ToString())) {
1638 return(true);
1639 }
1640 break;
1641 case 2:
1642 if(GrantVB.Count == 0 || GrantVB.ContainsKey(ownerUUID.ToString())) {
1643 return(true);
1644 }
1645 break;
1646 case 3:
1647 if(GrantJS.Count == 0 || GrantJS.ContainsKey(ownerUUID.ToString())) {
1648 return(true);
1649 }
1650 break;
1651 }
1652 return(false);
1653 }
1654
1655
1587 } 1656 }
1588} 1657}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index ab5f264..d0da618 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Region.Framework.Scenes
56 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 56 public delegate bool EditScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
57 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene); 57 public delegate bool EditNotecardHandler(UUID notecard, UUID objectID, UUID user, Scene scene);
58 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene); 58 public delegate bool RunScriptHandler(UUID script, UUID objectID, UUID user, Scene scene);
59 public delegate bool CompileScriptHandler(UUID ownerUUID, int scriptType, Scene scene);
59 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene); 60 public delegate bool StartScriptHandler(UUID script, UUID user, Scene scene);
60 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene); 61 public delegate bool StopScriptHandler(UUID script, UUID user, Scene scene);
61 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene); 62 public delegate bool ResetScriptHandler(UUID prim, UUID script, UUID user, Scene scene);
@@ -113,6 +114,7 @@ namespace OpenSim.Region.Framework.Scenes
113 public event EditScriptHandler OnEditScript; 114 public event EditScriptHandler OnEditScript;
114 public event EditNotecardHandler OnEditNotecard; 115 public event EditNotecardHandler OnEditNotecard;
115 public event RunScriptHandler OnRunScript; 116 public event RunScriptHandler OnRunScript;
117 public event CompileScriptHandler OnCompileScript;
116 public event StartScriptHandler OnStartScript; 118 public event StartScriptHandler OnStartScript;
117 public event StopScriptHandler OnStopScript; 119 public event StopScriptHandler OnStopScript;
118 public event ResetScriptHandler OnResetScript; 120 public event ResetScriptHandler OnResetScript;
@@ -510,6 +512,24 @@ namespace OpenSim.Region.Framework.Scenes
510 512
511 #endregion 513 #endregion
512 514
515 #region COMPILE SCRIPT (When Script needs to get (re)compiled)
516 public bool CanCompileScript(UUID ownerUUID, int scriptType)
517 {
518 CompileScriptHandler handler = OnCompileScript;
519 if (handler != null)
520 {
521 Delegate[] list = handler.GetInvocationList();
522 foreach (CompileScriptHandler h in list)
523 {
524 if (h(ownerUUID, scriptType, m_scene) == false)
525 return false;
526 }
527 }
528 return true;
529 }
530
531 #endregion
532
513 #region START SCRIPT (When Script run box is Checked after placed in object) 533 #region START SCRIPT (When Script run box is Checked after placed in object)
514 public bool CanStartScript(UUID script, UUID user) 534 public bool CanStartScript(UUID script, UUID user)
515 { 535 {
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 9897267..15d6c2c 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
153 // Compile (We assume LSL) 153 // Compile (We assume LSL)
154 CompiledScriptFile = 154 CompiledScriptFile =
155 LSLCompiler.PerformScriptCompile(Script, 155 LSLCompiler.PerformScriptCompile(Script,
156 assetID.ToString()); 156 assetID.ToString(), taskInventoryItem.OwnerID);
157 157
158 if (presence != null && (!postOnRez)) 158 if (presence != null && (!postOnRez))
159 presence.ControllingClient.SendAgentAlertMessage( 159 presence.ControllingClient.SendAgentAlertMessage(
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
index 1bba878..2fd819d 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/ICompiler.cs
@@ -27,13 +27,14 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse;
30using Nini.Config; 31using Nini.Config;
31 32
32namespace OpenSim.Region.ScriptEngine.Interfaces 33namespace OpenSim.Region.ScriptEngine.Interfaces
33{ 34{
34 public interface ICompiler 35 public interface ICompiler
35 { 36 {
36 string PerformScriptCompile(string source, string asset); 37 string PerformScriptCompile(string source, string asset, UUID ownerID);
37 string[] GetWarnings(); 38 string[] GetWarnings();
38 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> 39 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
39 LineMap(); 40 LineMap();
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index fcb3339..911da5b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -37,6 +37,7 @@ using Microsoft.VisualBasic;
37using log4net; 37using log4net;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.ScriptEngine.Interfaces; 39using OpenSim.Region.ScriptEngine.Interfaces;
40using OpenMetaverse;
40 41
41namespace OpenSim.Region.ScriptEngine.Shared.CodeTools 42namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
42{ 43{
@@ -263,7 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
263 /// </summary> 264 /// </summary>
264 /// <param name="Script">LSL script</param> 265 /// <param name="Script">LSL script</param>
265 /// <returns>Filename to .dll assembly</returns> 266 /// <returns>Filename to .dll assembly</returns>
266 public string PerformScriptCompile(string Script, string asset) 267 public string PerformScriptCompile(string Script, string asset, UUID ownerUUID)
267 { 268 {
268 m_positionMap = null; 269 m_positionMap = null;
269 m_warnings.Clear(); 270 m_warnings.Clear();
@@ -341,6 +342,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
341 throw new Exception(errtext); 342 throw new Exception(errtext);
342 } 343 }
343 344
345 if(m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)l) == false) {
346 // Not allowed to compile to this language!
347 string errtext = String.Empty;
348 errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!";
349 throw new Exception(errtext);
350 }
351
344 string compileScript = Script; 352 string compileScript = Script;
345 353
346 if (l == enumCompileType.lsl) 354 if (l == enumCompileType.lsl)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index cfabda1..34f8145 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -579,7 +579,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
579 lock (m_AddingAssemblies) 579 lock (m_AddingAssemblies)
580 { 580 {
581 assembly = m_Compiler.PerformScriptCompile(script, 581 assembly = m_Compiler.PerformScriptCompile(script,
582 assetID.ToString()); 582 assetID.ToString(), item.OwnerID);
583 if (!m_AddingAssemblies.ContainsKey(assembly)) { 583 if (!m_AddingAssemblies.ContainsKey(assembly)) {
584 m_AddingAssemblies[assembly] = 1; 584 m_AddingAssemblies[assembly] = 1;
585 } else { 585 } else {