aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
authorBlueWall2015-02-27 11:05:15 -0500
committerBlueWall2015-02-27 11:05:15 -0500
commita3681f3052fb5e98e31e7051329a5b748a8bdd8d (patch)
tree44a4c6beed75c2eb829a7770c2fa4a9498068a31 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
parentWhen an avatar is walking across a region border, force the first AgentUpdate... (diff)
downloadopensim-SC_OLD-a3681f3052fb5e98e31e7051329a5b748a8bdd8d.zip
opensim-SC_OLD-a3681f3052fb5e98e31e7051329a5b748a8bdd8d.tar.gz
opensim-SC_OLD-a3681f3052fb5e98e31e7051329a5b748a8bdd8d.tar.bz2
opensim-SC_OLD-a3681f3052fb5e98e31e7051329a5b748a8bdd8d.tar.xz
Adding dynamic ossl permission control
Add permission by identifying uuid (owner/creator/group) and function. Revoke permission in the same manner. Permission adjustments immediately effect running scripts ability to call os functions. osGrantScriptPermissions(UUID key,string function) Threat Level Severe osRevokeScriptPermissions(UUID key,string function) Threat Level Severe work sponsored by: Rage
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 10ddf14..f4bc45f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -264,6 +264,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
264 // or a string explaining why this function can't be used. 264 // or a string explaining why this function can't be used.
265 private string CheckThreatLevelTest(ThreatLevel level, string function) 265 private string CheckThreatLevelTest(ThreatLevel level, string function)
266 { 266 {
267 if(GetDynaPerms(m_item.CreatorID, m_item.OwnerID, m_item.GroupID, function))
268 return string.Empty;
269
267 if (!m_FunctionPerms.ContainsKey(function)) 270 if (!m_FunctionPerms.ContainsKey(function))
268 { 271 {
269 FunctionPerms perms = new FunctionPerms(); 272 FunctionPerms perms = new FunctionPerms();
@@ -431,6 +434,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
431 System.Threading.Thread.Sleep(delay); 434 System.Threading.Thread.Sleep(delay);
432 } 435 }
433 436
437 private bool GetDynaPerms(UUID owner, UUID creator, UUID group, string function)
438 {
439 if (World.GetOsslPerms(owner, function))
440 return true;
441 if (World.GetOsslPerms(creator, function))
442 return true;
443 if (World.GetOsslPerms(creator, function))
444 return true;
445
446 return false;
447
448 }
449
450 public void osGrantScriptPermissions(LSL_Key avatar, LSL_List osfunctions)
451 {
452 CheckThreatLevel(ThreatLevel.Severe, "osGrantScriptPermissions");
453 m_host.AddScriptLPS(1);
454 UUID key;
455 UUID.TryParse(avatar.m_string, out key);
456
457 for (int item = 0; item <= osfunctions.Length - 1; item++)
458 {
459 string function = osfunctions.GetLSLStringItem(item);
460 World.AddOsslPerm(key, function);
461 }
462 }
463
464 public void osRevokeScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
465 {
466 CheckThreatLevel(ThreatLevel.Severe, "osRevokeScriptPermissions");
467 m_host.AddScriptLPS(1);
468 UUID key;
469 UUID.TryParse(avatar.m_string, out key);
470
471 for (int item = 0; item <= osfunctions.Length - 1; item++)
472 {
473 string function = osfunctions.GetLSLStringItem(item);
474 World.RemoveOsslPerm(key, function);
475 }
476 }
477
434 public LSL_Integer osSetTerrainHeight(int x, int y, double val) 478 public LSL_Integer osSetTerrainHeight(int x, int y, double val)
435 { 479 {
436 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); 480 CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");