aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Permissions
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-05 09:47:42 +0000
committerMelanie Thielker2009-06-05 09:47:42 +0000
commit9f932a42057b4a9cd4517c90007a7c31c98277c6 (patch)
treeb0183d1d5317e9408c73924a3a97cb31e3a4adf7 /OpenSim/Region/CoreModules/World/Permissions
parent* convenience ignores (diff)
downloadopensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.zip
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.gz
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.bz2
opensim-SC-9f932a42057b4a9cd4517c90007a7c31c98277c6.tar.xz
Thank you, thomax, for a patch to provide finer-grained access control to
scripting. Fixes Mantis #2862
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Permissions')
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs69
1 files changed, 69 insertions, 0 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}