* Comitting 0001271: [PATCH] Refactor permissions to fully allow stacking permissions modules. From Melanie. Thanks Melanie!

0.6.0-stable
Teravus Ovares 2008-05-14 23:25:07 +00:00
parent 2a988f187e
commit a4efa93993
8 changed files with 92 additions and 42 deletions

View File

@ -31,8 +31,5 @@ namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IScenePermissions public interface IScenePermissions
{ {
bool BypassPermissions { get; set; }
bool BypassPermissionsValue { get; set; }
uint GenerateClientFlags(LLUUID user, LLUUID objID);
} }
} }

View File

@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
// So make sure you really trust your region owners. because they can add other estate manaagers to your other estates // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions) if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID);
@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
case 512: case 512:
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
// So make sure you really trust your region owners. because they can add other estate manaagers to your other estates // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions) if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); remote_client.sendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID);

View File

@ -63,23 +63,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
private bool m_bypassPermissions = false; private bool m_bypassPermissions = false;
private bool m_bypassPermissionsValue = true; private bool m_bypassPermissionsValue = true;
private bool m_debugPermissions = false; private bool m_debugPermissions = false;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
set { m_bypassPermissions = value; }
}
public bool BypassPermissionsValue
{
get { return m_bypassPermissionsValue; }
set { m_bypassPermissionsValue = value; }
}
public bool DebugPermissions
{
get { return m_debugPermissions; }
set { m_debugPermissions = value; }
}
#endregion #endregion
#region ICommandableModule Members #region ICommandableModule Members
@ -157,7 +141,10 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
m_scene.RegisterModuleInterface<IScenePermissions>(this); m_scene.RegisterModuleInterface<IScenePermissions>(this);
//Register functions with Scene External Checks! //Register functions with Scene External Checks!
m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
@ -260,6 +247,16 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
} }
#endregion #endregion
public bool BypassPermissions()
{
return m_bypassPermissions;
}
public void SetBypassPermissions(bool value)
{
m_bypassPermissions=value;
}
#region Object Permissions #region Object Permissions
public uint GenerateClientFlags(LLUUID user, LLUUID objID) public uint GenerateClientFlags(LLUUID user, LLUUID objID)

View File

@ -115,7 +115,6 @@ namespace OpenSim.Region.Environment.Scenes
protected IXMLRPC m_xmlrpcModule; protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule; protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory; protected IAvatarFactory m_AvatarFactory;
protected IScenePermissions m_permissions;
protected IConfigSource m_config; protected IConfigSource m_config;
// Central Update Loop // Central Update Loop
@ -173,14 +172,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_timedilation; } get { return m_timedilation; }
} }
/// <summary>
/// The reference by which general permissions in the scene can be set and queried.
/// </summary>
public IScenePermissions Permissions
{
get { return m_permissions; }
}
public int TimePhase public int TimePhase
{ {
get { return m_timePhase; } get { return m_timePhase; }
@ -660,7 +651,6 @@ namespace OpenSim.Region.Environment.Scenes
m_worldCommModule = RequestModuleInterface<IWorldComm>(); m_worldCommModule = RequestModuleInterface<IWorldComm>();
XferManager = RequestModuleInterface<IXfer>(); XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_permissions = RequestModuleInterface<IScenePermissions>();
} }
#endregion #endregion

View File

@ -45,6 +45,78 @@ namespace OpenSim.Region.Environment.Scenes
#region Object Permission Checks #region Object Permission Checks
public delegate uint GenerateClientFlags(LLUUID userID, LLUUID objectIDID);
private List<GenerateClientFlags> GenerateClientFlagsCheckFunctions = new List<GenerateClientFlags>();
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<SetBypassPermissions> SetBypassPermissionsCheckFunctions = new List<SetBypassPermissions>();
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<BypassPermissions> BypassPermissionsCheckFunctions = new List<BypassPermissions>();
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 #region REZ OBJECT
public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene); public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>(); private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) 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<Scene> func) private void ForEachCurrentScene(Action<Scene> func)

View File

@ -1351,7 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part.OwnerID != cAgentID) if (part.OwnerID != cAgentID)
{ {
// Apply Next Owner Permissions if we're not bypassing permissions // Apply Next Owner Permissions if we're not bypassing permissions
if (!m_scene.Permissions.BypassPermissions) if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions())
m_rootPart.ApplyNextOwnerPermissions(); m_rootPart.ApplyNextOwnerPermissions();
} }

View File

@ -476,13 +476,7 @@ namespace OpenSim.Region.Environment.Scenes
public uint GenerateClientFlags(LLUUID ObjectID) public uint GenerateClientFlags(LLUUID ObjectID)
{ {
if(m_scene.Permissions == null) return m_scene.ExternalChecks.ExternalChecksGenerateClientFlags(m_uuid, ObjectID);
{
SceneObjectPart task=m_scene.GetSceneObjectPart(ObjectID);
return task.GetEffectiveObjectFlags() | (uint)2147483647;
}
return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
} }
/// <summary> /// <summary>