From aeb8a4bf85816595c9c2ba82413e309e7aa69062 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Fri, 27 Feb 2015 12:27:10 -0500
Subject: Revert "Adding dynamic ossl permission control"

This reverts commit a3681f3052fb5e98e31e7051329a5b748a8bdd8d until
further testing. Jenkins now fails ossl tests.
---
 OpenSim/Region/Framework/Scenes/Scene.cs           | 61 ----------------------
 .../Shared/Api/Implementation/OSSL_Api.cs          | 44 ----------------
 .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs |  4 --
 .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs   | 10 ----
 4 files changed, 119 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 018e837..21d47aa 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -170,9 +170,6 @@ namespace OpenSim.Region.Framework.Scenes
         }
         private bool m_scripts_enabled;
 
-        // Dynamic ossl function permissions
-        private Dictionary<string, List<UUID>> m_DynaPerms = new Dictionary<string, List<UUID>>();
-
         public SynchronizeSceneHandler SynchronizeScene;
 
         /// <summary>
@@ -5896,63 +5893,5 @@ namespace OpenSim.Region.Framework.Scenes
 
             m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty);
         }
-
-        public bool AddOsslPerm (UUID key, string function)
-        {
-            StackTrace calls = new StackTrace ();
-            string caller = calls.GetFrame (1).GetMethod ().Name;
-            if (caller != "osGrantScriptPermissions") 
-            {
-                m_log.ErrorFormat("[SCENE]: {0} cannot adjust script perms!",caller);
-                return false;
-            }
-
-            if (string.IsNullOrEmpty(function))
-                return false;
-
-            if (!m_DynaPerms.ContainsKey(function)) 
-            {
-                List<UUID> keys = new List<UUID> ();
-                keys.Add (key);
-                m_DynaPerms[function] = keys;
-                return true;
-            }
-
-            if (!m_DynaPerms[function].Contains(key))
-                m_DynaPerms[function].Add(key);
-
-            return true;
-        }
-
-        public bool GetOsslPerms(UUID avatar, string function)
-        {
-            if (m_DynaPerms.ContainsKey(function))
-                if(m_DynaPerms[function].Contains(avatar))
-                    return true;
-
-            return false;
-        }
-
-        public bool RemoveOsslPerm(UUID key, string function)
-        {
-            StackTrace calls = new StackTrace ();
-            string caller = calls.GetFrame (1).GetMethod ().Name;
-            if (caller != "osRevokeScriptPermissions") 
-            {
-                m_log.ErrorFormat("[SCENE]: {0} cannot adjust script perms!",caller);
-                return false;
-            }
-
-            if (m_DynaPerms.ContainsKey (function)) 
-            {
-                if (m_DynaPerms [function].Contains (key)) 
-                {
-                    m_DynaPerms [function].Remove (key);
-                    if (m_DynaPerms [function].Count == 0)
-                        m_DynaPerms.Remove (function);
-                }
-            }
-            return true;
-        }
     }
 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f4bc45f..10ddf14 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -264,9 +264,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
         //     or a string explaining why this function can't be used.
         private string CheckThreatLevelTest(ThreatLevel level, string function)
         {
-            if(GetDynaPerms(m_item.CreatorID, m_item.OwnerID, m_item.GroupID, function))
-                return string.Empty;
-
             if (!m_FunctionPerms.ContainsKey(function))
             {
                 FunctionPerms perms = new FunctionPerms();
@@ -434,47 +431,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
             System.Threading.Thread.Sleep(delay);
         }
 
-        private bool GetDynaPerms(UUID owner, UUID creator, UUID group, string function)
-        {
-            if (World.GetOsslPerms(owner, function))
-                return true;
-            if (World.GetOsslPerms(creator, function))
-                return true;
-            if (World.GetOsslPerms(creator, function))
-                return true;
-
-            return false;
-           
-        }
-
-        public void osGrantScriptPermissions(LSL_Key avatar, LSL_List osfunctions)
-        {
-            CheckThreatLevel(ThreatLevel.Severe, "osGrantScriptPermissions");
-            m_host.AddScriptLPS(1);
-            UUID key;
-            UUID.TryParse(avatar.m_string, out key);
-
-            for (int item = 0; item <= osfunctions.Length - 1; item++) 
-            {
-                string function = osfunctions.GetLSLStringItem(item);
-                World.AddOsslPerm(key, function);
-            }
-        }
-
-        public void osRevokeScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
-        {
-            CheckThreatLevel(ThreatLevel.Severe, "osRevokeScriptPermissions");
-            m_host.AddScriptLPS(1);
-            UUID key;
-            UUID.TryParse(avatar.m_string, out key);
-
-            for (int item = 0; item <= osfunctions.Length - 1; item++) 
-            {
-                string function = osfunctions.GetLSLStringItem(item);
-                World.RemoveOsslPerm(key, function);
-            }
-        }
-
         public LSL_Integer osSetTerrainHeight(int x, int y, double val)
         {
             CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 2cbaf5a..38d4574 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -116,10 +116,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
     {
         void CheckThreatLevel(ThreatLevel level, string function);
 
-        // Scripted Script Permissions
-        void osGrantScriptPermissions(LSL_Key avatar, LSL_List functions);
-        void osRevokeScriptPermissions(LSL_Key avatar, LSL_List functions);
-
         //OpenSim functions
         string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
         string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index a98f6ac..352a35d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -61,16 +61,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
             Prim = new OSSLPrim(this);
         }
 
-        public void osGrantScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
-        {
-            m_OSSL_Functions.osGrantScriptPermissions(avatar, osfunctions); 
-        }
-
-        public void osRevokeScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
-        {
-            m_OSSL_Functions.osRevokeScriptPermissions(avatar, osfunctions); 
-        }
-
         public void osSetRegionWaterHeight(double height)
         {
             m_OSSL_Functions.osSetRegionWaterHeight(height);
-- 
cgit v1.1