diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 21d47aa..018e837 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -170,6 +170,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | } | 170 | } |
171 | private bool m_scripts_enabled; | 171 | private bool m_scripts_enabled; |
172 | 172 | ||
173 | // Dynamic ossl function permissions | ||
174 | private Dictionary<string, List<UUID>> m_DynaPerms = new Dictionary<string, List<UUID>>(); | ||
175 | |||
173 | public SynchronizeSceneHandler SynchronizeScene; | 176 | public SynchronizeSceneHandler SynchronizeScene; |
174 | 177 | ||
175 | /// <summary> | 178 | /// <summary> |
@@ -5893,5 +5896,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
5893 | 5896 | ||
5894 | m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty); | 5897 | m_eventManager.TriggerExtraSettingChanged(this, name, String.Empty); |
5895 | } | 5898 | } |
5899 | |||
5900 | public bool AddOsslPerm (UUID key, string function) | ||
5901 | { | ||
5902 | StackTrace calls = new StackTrace (); | ||
5903 | string caller = calls.GetFrame (1).GetMethod ().Name; | ||
5904 | if (caller != "osGrantScriptPermissions") | ||
5905 | { | ||
5906 | m_log.ErrorFormat("[SCENE]: {0} cannot adjust script perms!",caller); | ||
5907 | return false; | ||
5908 | } | ||
5909 | |||
5910 | if (string.IsNullOrEmpty(function)) | ||
5911 | return false; | ||
5912 | |||
5913 | if (!m_DynaPerms.ContainsKey(function)) | ||
5914 | { | ||
5915 | List<UUID> keys = new List<UUID> (); | ||
5916 | keys.Add (key); | ||
5917 | m_DynaPerms[function] = keys; | ||
5918 | return true; | ||
5919 | } | ||
5920 | |||
5921 | if (!m_DynaPerms[function].Contains(key)) | ||
5922 | m_DynaPerms[function].Add(key); | ||
5923 | |||
5924 | return true; | ||
5925 | } | ||
5926 | |||
5927 | public bool GetOsslPerms(UUID avatar, string function) | ||
5928 | { | ||
5929 | if (m_DynaPerms.ContainsKey(function)) | ||
5930 | if(m_DynaPerms[function].Contains(avatar)) | ||
5931 | return true; | ||
5932 | |||
5933 | return false; | ||
5934 | } | ||
5935 | |||
5936 | public bool RemoveOsslPerm(UUID key, string function) | ||
5937 | { | ||
5938 | StackTrace calls = new StackTrace (); | ||
5939 | string caller = calls.GetFrame (1).GetMethod ().Name; | ||
5940 | if (caller != "osRevokeScriptPermissions") | ||
5941 | { | ||
5942 | m_log.ErrorFormat("[SCENE]: {0} cannot adjust script perms!",caller); | ||
5943 | return false; | ||
5944 | } | ||
5945 | |||
5946 | if (m_DynaPerms.ContainsKey (function)) | ||
5947 | { | ||
5948 | if (m_DynaPerms [function].Contains (key)) | ||
5949 | { | ||
5950 | m_DynaPerms [function].Remove (key); | ||
5951 | if (m_DynaPerms [function].Count == 0) | ||
5952 | m_DynaPerms.Remove (function); | ||
5953 | } | ||
5954 | } | ||
5955 | return true; | ||
5956 | } | ||
5896 | } | 5957 | } |
5897 | } | 5958 | } |