From a4efa939932f823af2affe0e97446a8d807004e0 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Wed, 14 May 2008 23:25:07 +0000
Subject: * Comitting 0001271: [PATCH] Refactor permissions to fully allow
stacking permissions modules. From Melanie. Thanks Melanie!
---
OpenSim/Region/Environment/Scenes/Scene.cs | 10 ---
.../Environment/Scenes/SceneExternalChecks.cs | 74 +++++++++++++++++++++-
OpenSim/Region/Environment/Scenes/SceneManager.cs | 2 +-
.../Region/Environment/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 8 +--
5 files changed, 76 insertions(+), 20 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 5b93ef9..51f2942 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -115,7 +115,6 @@ namespace OpenSim.Region.Environment.Scenes
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
- protected IScenePermissions m_permissions;
protected IConfigSource m_config;
// Central Update Loop
@@ -173,14 +172,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_timedilation; }
}
- ///
- /// The reference by which general permissions in the scene can be set and queried.
- ///
- public IScenePermissions Permissions
- {
- get { return m_permissions; }
- }
-
public int TimePhase
{
get { return m_timePhase; }
@@ -660,7 +651,6 @@ namespace OpenSim.Region.Environment.Scenes
m_worldCommModule = RequestModuleInterface();
XferManager = RequestModuleInterface();
m_AvatarFactory = RequestModuleInterface();
- m_permissions = RequestModuleInterface();
}
#endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
index aa4e043..53c8fc3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneExternalChecks.cs
@@ -45,6 +45,78 @@ namespace OpenSim.Region.Environment.Scenes
#region Object Permission Checks
+ public delegate uint GenerateClientFlags(LLUUID userID, LLUUID objectIDID);
+ private List GenerateClientFlagsCheckFunctions = new List();
+
+ public void addGenerateClientFlags(GenerateClientFlags delegateFunc)
+ {
+ if (!GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
+ GenerateClientFlagsCheckFunctions.Add(delegateFunc);
+ }
+ public void removeGenerateClientFlags(GenerateClientFlags delegateFunc)
+ {
+ if (GenerateClientFlagsCheckFunctions.Contains(delegateFunc))
+ GenerateClientFlagsCheckFunctions.Remove(delegateFunc);
+ }
+
+ public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID)
+ {
+ uint perms=(uint)2147483647;
+ foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions)
+ {
+ perms &= check(userID, objectID);
+ }
+ return perms;
+ }
+
+ public delegate void SetBypassPermissions(bool value);
+ private List SetBypassPermissionsCheckFunctions = new List();
+
+ public void addSetBypassPermissions(SetBypassPermissions delegateFunc)
+ {
+ if (!SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
+ SetBypassPermissionsCheckFunctions.Add(delegateFunc);
+ }
+ public void removeSetBypassPermissions(SetBypassPermissions delegateFunc)
+ {
+ if (SetBypassPermissionsCheckFunctions.Contains(delegateFunc))
+ SetBypassPermissionsCheckFunctions.Remove(delegateFunc);
+ }
+
+ public void ExternalChecksSetBypassPermissions(bool value)
+ {
+ foreach (SetBypassPermissions check in SetBypassPermissionsCheckFunctions)
+ {
+ check(value);
+ }
+ }
+
+ public delegate bool BypassPermissions();
+ private List BypassPermissionsCheckFunctions = new List();
+
+ public void addBypassPermissions(BypassPermissions delegateFunc)
+ {
+ if (!BypassPermissionsCheckFunctions.Contains(delegateFunc))
+ BypassPermissionsCheckFunctions.Add(delegateFunc);
+ }
+ public void removeBypassPermissions(BypassPermissions delegateFunc)
+ {
+ if (BypassPermissionsCheckFunctions.Contains(delegateFunc))
+ BypassPermissionsCheckFunctions.Remove(delegateFunc);
+ }
+
+ public bool ExternalChecksBypassPermissions()
+ {
+ foreach (BypassPermissions check in BypassPermissionsCheckFunctions)
+ {
+ if (check() == false)
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
#region REZ OBJECT
public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
private List CanRezObjectCheckFunctions = new List();
@@ -654,4 +726,4 @@ namespace OpenSim.Region.Environment.Scenes
}
}
-
\ No newline at end of file
+
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 1f1f39f..215ab75 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{
- ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.BypassPermissions = bypassPermissions; });
+ ForEachCurrentScene(delegate(Scene scene) { scene.ExternalChecks.ExternalChecksSetBypassPermissions(bypassPermissions); });
}
private void ForEachCurrentScene(Action func)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 4a112ae..3ec6ed8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1351,7 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part.OwnerID != cAgentID)
{
// Apply Next Owner Permissions if we're not bypassing permissions
- if (!m_scene.Permissions.BypassPermissions)
+ if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions())
m_rootPart.ApplyNextOwnerPermissions();
}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 4ef0d27..8ac1a77 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -476,13 +476,7 @@ namespace OpenSim.Region.Environment.Scenes
public uint GenerateClientFlags(LLUUID ObjectID)
{
- if(m_scene.Permissions == null)
- {
- SceneObjectPart task=m_scene.GetSceneObjectPart(ObjectID);
-
- return task.GetEffectiveObjectFlags() | (uint)2147483647;
- }
- return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
+ return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID);
}
///
--
cgit v1.1