* Refactor: Break out permissions code into a separate region PermissionsModule

0.6.0-stable
Justin Clarke Casey 2008-05-05 20:14:53 +00:00
parent 60a83574f4
commit 9655cf2807
18 changed files with 219 additions and 124 deletions

View File

@ -36,12 +36,12 @@ namespace OpenSim.Grid.ScriptServer
{
public class FakeScene: Scene
{
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool sendTasksToChild)
: base(
regInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeManager, httpServer,
regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer,
moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild)
{
}

View File

@ -74,7 +74,6 @@ namespace OpenSim
protected List<RegionInfo> m_regionData = new List<RegionInfo>();
protected bool m_physicalPrim;
protected bool m_permissions = false;
protected bool m_standaloneAuthenticate = false;
protected string m_standaloneWelcomeMessage = null;
@ -263,9 +262,7 @@ namespace OpenSim
m_physicalPrim = startupConfig.GetBoolean("physical_prim", true);
m_see_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true);
m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false);
m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.Data.SQLite.dll");
if (m_storageDll == "OpenSim.DataStore.MonoSqlite.dll")
{
@ -490,7 +487,7 @@ namespace OpenSim
}
IClientNetworkServer clientServer;
Scene scene = SetupScene(regionInfo, proxyOffset, out clientServer, m_permissions);
Scene scene = SetupScene(regionInfo, proxyOffset, out clientServer);
m_log.Info("[MODULES]: Loading Region's modules");
@ -530,9 +527,6 @@ namespace OpenSim
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(true);
scene.RegisterRegionWithGrid();
//Server side object editing permissions checking
scene.PermissionsMngr.BypassPermissions = !m_permissions;
// We need to do this after we've initialized the scripting engines.
scene.StartScripts();
@ -565,10 +559,9 @@ namespace OpenSim
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
{
PermissionManager permissionManager = new PermissionManager();
SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
return
new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache,
new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor);
}

View File

@ -4956,13 +4956,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
case "getinfo":
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
}
break;
case "setregioninfo":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter),
convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
@ -4975,7 +4975,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "texturebase":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -4990,7 +4990,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "texturedetail":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5008,7 +5008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "textureheights":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5029,7 +5029,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OnCommitEstateTerrainTextureRequest(this);
break;
case "setregionterrain":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
if (messagePacket.ParamList.Length != 9)
{
@ -5064,7 +5064,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "restart":
if (((Scene)m_scene).PermissionsMngr.CanRestartSim(this.AgentId))
if (((Scene)m_scene).Permissions.CanRestartSim(this.AgentId))
{
// There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
@ -5078,7 +5078,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "estatechangecovenantid":
if (((Scene)m_scene).PermissionsMngr.CanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).Permissions.CanEditEstateTerrain(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5088,7 +5088,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice,estateAccessType,new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)));
@ -5096,7 +5096,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "simulatormessage":
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@ -5107,7 +5107,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "instantmessage":
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@ -5118,7 +5118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "setregiondebug":
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID;
@ -5130,7 +5130,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "teleporthomeuser":
if (((Scene)m_scene).PermissionsMngr.GenericEstatePermission(this.AgentId))
if (((Scene)m_scene).Permissions.GenericEstatePermission(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID;

View File

@ -107,12 +107,12 @@ namespace OpenSim.Region.ClientStack
return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
}
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer, bool m_permissions)
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)
{
return SetupScene(regionInfo, 0, out clientServer, m_permissions);
return SetupScene(regionInfo, 0, out clientServer);
}
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out IClientNetworkServer clientServer, bool m_permissions)
protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, out IClientNetworkServer clientServer)
{
AgentCircuitManager circuitManager = new AgentCircuitManager();
IPAddress listenIP = regionInfo.InternalEndPoint.Address;
@ -162,8 +162,9 @@ namespace OpenSim.Region.ClientStack
scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero;
}
scene.LoadPrimsFromStorage(m_permissions, regionInfo.originRegionID);
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
scene.StartTimer();
return scene;
}

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IScenePermissions
{
bool BypassPermissions { get; set; }
#region Object Permissions
bool CanRezObject(LLUUID user, LLVector3 position);
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
bool CanDeRezObject(LLUUID user, LLUUID obj);
bool CanCopyObject(LLUUID user, LLUUID obj);
bool CanEditObject(LLUUID user, LLUUID obj);
bool CanEditObjectPosition(LLUUID user, LLUUID obj);
/// <summary>
/// Permissions check - can user enter an object?
/// </summary>
/// <param name="user">User attempting move an object</param>
/// <param name="oldPos">Source object-position</param>
/// <param name="newPos">Target object-position</param>
/// <returns>Has permission?</returns>
bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos);
bool CanReturnObject(LLUUID user, LLUUID obj);
#endregion
#region Uncategorized permissions
bool CanInstantMessage(LLUUID user, LLUUID target);
bool CanInventoryTransfer(LLUUID user, LLUUID target);
bool CanEditScript(LLUUID user, LLUUID script);
bool CanRunScript(LLUUID user, LLUUID script);
bool CanRunConsoleCommand(LLUUID user);
bool CanTerraform(LLUUID user, LLVector3 position);
#endregion
#region Estate Permissions
bool IsEstateManager(LLUUID user);
bool GenericEstatePermission(LLUUID user);
bool CanEditEstateTerrain(LLUUID user);
bool CanRestartSim(LLUUID user);
bool CanEditParcel(LLUUID user, ILandObject parcel);
bool CanSellParcel(LLUUID user, ILandObject parcel);
bool CanAbandonParcel(LLUUID user, ILandObject parcel);
#endregion
uint GenerateClientFlags(LLUUID user, LLUUID objID);
}
}

View File

@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
public XferModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)

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
// 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.PermissionsMngr.BypassPermissions)
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions)
{
m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
remote_client.sendEstateManagersList(invoice);
@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
case 512:
// 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
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.Permissions.BypassPermissions)
{
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
remote_client.sendEstateManagersList(invoice);

View File

@ -26,12 +26,14 @@
*/
using libsecondlife;
using Nini.Config;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment
namespace OpenSim.Region.Environment.Modules.World.Permissions
{
public class PermissionManager
public class PermissionsModule : IRegionModule, IScenePermissions
{
protected Scene m_scene;
@ -43,11 +45,9 @@ namespace OpenSim.Region.Environment
private uint PERM_MOVE = (uint)524288;
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = (uint)540672;
// Bypasses the permissions engine (always returns OK)
// disable in any production environment
// TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option.
private bool m_bypassPermissions = true;
// Bypasses the permissions engine
private bool m_bypassPermissions = false;
public bool BypassPermissions
{
@ -55,20 +55,40 @@ namespace OpenSim.Region.Environment
set { m_bypassPermissions = value; }
}
public PermissionManager()
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
// FIXME: Possibly move all permissions related stuff to its own section
IConfig myConfig = config.Configs["Startup"];
m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false);
m_scene.RegisterModuleInterface<IScenePermissions>(this);
}
public void PostInitialise()
{
}
public PermissionManager(Scene scene)
public void Close()
{
m_scene = scene;
}
public void Initialise(Scene scene)
public string Name
{
m_scene = scene;
get { return "PermissionsModule"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
protected virtual void SendPermissionError(LLUUID user, string reason)
{
m_scene.EventManager.TriggerPermissionError(user, reason);
@ -159,17 +179,9 @@ namespace OpenSim.Region.Environment
return permission;
}
/// <summary>
/// Permissions check - can user enter an object?
/// </summary>
/// <param name="user">User attempting move an object</param>
/// <param name="oldPos">Source object-position</param>
/// <param name="newPos">Target object-position</param>
/// <returns>Has permission?</returns>
/// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
public virtual bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
{
if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
{
return true;
@ -214,7 +226,6 @@ namespace OpenSim.Region.Environment
public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
{
// Here's the way this works,
// ObjectFlags and Permission flags are two different enumerations
// ObjectFlags, however, tells the client to change what it will allow the user to do.
@ -296,8 +307,6 @@ namespace OpenSim.Region.Environment
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
// We are adding the temporary objectflags to the object's objectflags based on the
@ -395,12 +404,7 @@ namespace OpenSim.Region.Environment
return permission;
}
/// <summary>
/// Permissions check - can user delete an object?
/// </summary>
/// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param>
/// <returns>Has permission?</returns>
/// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{
return GenericObjectPermission(user, obj);
@ -522,7 +526,7 @@ namespace OpenSim.Region.Environment
#region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
protected virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";

View File

@ -449,7 +449,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
float south, float east, IClientAPI remoteClient)
{
// Not a good permissions check, if in area mode, need to check the entire area.
if (m_scene.PermissionsMngr.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0)))
if (m_scene.Permissions.CanTerraform(remoteClient.AgentId, new LLVector3(north, west, 0)))
{
if (north == south && east == west)
{

View File

@ -63,7 +63,6 @@ namespace OpenSim.Region.Environment.Scenes
protected RegionInfo m_regInfo;
protected Scene m_parentScene;
protected PermissionManager PermissionsMngr;
protected List<EntityBase> m_updateList = new List<EntityBase>();
protected int m_numRootAgents = 0;
protected int m_numPrim = 0;
@ -79,11 +78,10 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
public InnerScene(Scene parent, RegionInfo regInfo)
{
m_parentScene = parent;
m_regInfo = regInfo;
PermissionsMngr = permissionsMngr;
QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
QuadTree.Subdivide();
QuadTree.Subdivide();
@ -1031,7 +1029,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.Resize(scale, localID);
}
@ -1042,7 +1040,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.GroupResize(scale, localID);
}
@ -1078,7 +1076,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.UpdateSingleRotation(rot, localID);
}
@ -1096,7 +1094,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.UpdateGroupRotation(rot);
}
@ -1115,7 +1113,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.UpdateGroupRotation(pos, rot);
}
@ -1128,12 +1126,12 @@ namespace OpenSim.Region.Environment.Scenes
if (group != null)
{
LLVector3 oldPos = group.AbsolutePosition;
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
return;
}
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
{
group.UpdateSinglePosition(pos, localID);
}
@ -1159,12 +1157,12 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (!PermissionsMngr.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
return;
}
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
{
group.UpdateGroupPosition(pos);
}
@ -1183,7 +1181,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))
{
group.UpdateTextureEntry(localID, texture);
}
@ -1201,7 +1199,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
{
group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes());
}
@ -1213,7 +1211,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(objectID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.)
if (m_parentScene.Permissions.CanEditObjectPosition(remoteClient.AgentId, group.UUID))// && PermissionsMngr.)
{
group.GrabMovement(offset, pos, remoteClient);
}
@ -1235,7 +1233,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
{
group.SetPartName(Util.CleanString(name), primLocalID);
}
@ -1252,7 +1250,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
if (m_parentScene.Permissions.CanEditObject(remoteClient.AgentId, group.UUID))
{
group.SetPartDescription(Util.CleanString(description), primLocalID);
}
@ -1265,7 +1263,7 @@ namespace OpenSim.Region.Environment.Scenes
if (group != null)
{
if (PermissionsMngr.CanEditObject(agentID, group.UUID))
if (m_parentScene.Permissions.CanEditObject(agentID, group.UUID))
{
group.UpdateExtraParam(primLocalID, type, inUse, data);
}
@ -1282,7 +1280,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null)
{
if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
if (m_parentScene.Permissions.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
{
group.UpdateShape(shapeBlock, primLocalID);
}
@ -1448,11 +1446,11 @@ namespace OpenSim.Region.Environment.Scenes
// * Asset/DRM permission bit "modify" is enabled
//use CanEditObjectPosition
if (IncludeInSearch && PermissionsMngr.CanEditObject(user, objid))
if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(user, objid))
{
obj.AddFlag(LLObject.ObjectFlags.JointWheel);
}
else if (!IncludeInSearch && PermissionsMngr.CanEditObjectPosition(user, objid))
else if (!IncludeInSearch && m_parentScene.Permissions.CanEditObjectPosition(user, objid))
{
obj.RemFlag(LLObject.ObjectFlags.JointWheel);
}
@ -1485,7 +1483,7 @@ namespace OpenSim.Region.Environment.Scenes
if (originPrim != null)
{
if (PermissionsMngr.CanCopyObject(AgentID, originPrim.UUID))
if (m_parentScene.Permissions.CanCopyObject(AgentID, originPrim.UUID))
{
SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
copy.AbsolutePosition = copy.AbsolutePosition + offset;

View File

@ -73,7 +73,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendInventoryItemCreateUpdate(item);
int userlevel = 0;
if (PermissionsMngr.IsEstateManager(remoteClient.AgentId))
if (Permissions.IsEstateManager(remoteClient.AgentId))
{
userlevel = 1;
}
@ -784,7 +784,7 @@ namespace OpenSim.Region.Environment.Scenes
}
// bool permission;
// permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
// permission = Permissions.CanCopyObject(remoteClient.AgentId,
// ((SceneObjectGroup) selectedEnt).UUID);
// Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
@ -988,12 +988,12 @@ namespace OpenSim.Region.Environment.Scenes
bool permission;
if (DeRezPacket.AgentBlock.Destination == 1)
{ // Take Copy
permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
permission = Permissions.CanCopyObject(remoteClient.AgentId,
((SceneObjectGroup) selectedEnt).UUID);
}
else
{ // Take
permission = PermissionsMngr.CanDeRezObject(remoteClient.AgentId,
permission = Permissions.CanDeRezObject(remoteClient.AgentId,
((SceneObjectGroup) selectedEnt).UUID);
}
@ -1267,7 +1267,7 @@ namespace OpenSim.Region.Environment.Scenes
RayStart, RayEnd, RayTargetID, new LLQuaternion(0, 0, 0, 1),
BypassRayCast, bRayEndIsIntersection,true,scale, false);
if (!PermissionsMngr.CanRezObject(remoteClient.AgentId, pos) && !attachment)
if (!Permissions.CanRezObject(remoteClient.AgentId, pos) && !attachment)
{
return null;
}
@ -1361,7 +1361,7 @@ namespace OpenSim.Region.Environment.Scenes
{
LLUUID ownerID = item.OwnerID;
if (!PermissionsMngr.CanRezObject(ownerID, pos))
if (!Permissions.CanRezObject(ownerID, pos))
{
return null;
}

View File

@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Scenes
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
{
((SceneObjectGroup) ent).GetProperties(remoteClient);
((SceneObjectGroup) ent).IsSelected = true;
@ -112,7 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (((SceneObjectGroup) ent).LocalId == primLocalID)
{
if (m_permissionManager.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || m_permissionManager.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
if (Permissions.CanEditObjectPosition(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID) || Permissions.CanEditObject(remoteClient.AgentId, ((SceneObjectGroup)ent).UUID))
{
((SceneObjectGroup) ent).IsSelected = false;
LandChannel.setPrimsTainted();

View File

@ -114,6 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
protected IScenePermissions m_permissions;
// Central Update Loop
@ -169,13 +170,12 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_timedilation; }
}
protected readonly PermissionManager m_permissionManager;
// This is the instance to the permissions manager.
// This manages permissions to clients on in world objects
public PermissionManager PermissionsMngr
/// <summary>
/// The reference by which general permissions in the scene can be set and queried.
/// </summary>
public IScenePermissions Permissions
{
get { return m_permissionManager; }
get { return m_permissions; }
}
public int TimePhase
@ -219,7 +219,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor)
@ -248,10 +248,7 @@ namespace OpenSim.Region.Environment.Scenes
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
m_permissionManager = permissionManager;
m_permissionManager.Initialise(this);
m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
m_innerScene = new InnerScene(this, m_regInfo);
// If the Inner scene has an Unrecoverable error, restart this sim.
// Currently the only thing that causes it to happen is two kinds of specific
@ -613,6 +610,9 @@ namespace OpenSim.Region.Environment.Scenes
m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
}
/// <summary>
/// Sets up references to loaded modules required by thie scene
/// </summary>
public void SetModuleInterfaces()
{
m_simChatModule = RequestModuleInterface<ISimChat>();
@ -621,6 +621,7 @@ namespace OpenSim.Region.Environment.Scenes
m_worldCommModule = RequestModuleInterface<IWorldComm>();
XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_permissions = RequestModuleInterface<IScenePermissions>();
}
#endregion
@ -1121,7 +1122,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
/// Loads the World's objects
/// </summary>
public virtual void LoadPrimsFromStorage(bool m_permissions, LLUUID regionID)
public virtual void LoadPrimsFromStorage(LLUUID regionID)
{
m_log.Info("[SCENE]: Loading objects from datastore");
@ -1243,12 +1244,11 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection, true, new LLVector3(0.5f,0.5f,0.5f), false);
if (PermissionsMngr.CanRezObject(ownerID, pos))
if (Permissions.CanRezObject(ownerID, pos))
{
// rez ON the ground, not IN the ground
pos.Z += 0.25F;
AddNewPrim(ownerID, pos, rot, shape);
}
}
@ -2499,7 +2499,7 @@ namespace OpenSim.Region.Environment.Scenes
IClientAPI controllingClient)
{
// First check that this is the sim owner
if (m_permissionManager.GenericEstatePermission(agentID))
if (Permissions.GenericEstatePermission(agentID))
{
// User needs to be logged into this sim
if (m_scenePresences.ContainsKey(agentID))
@ -2577,7 +2577,7 @@ namespace OpenSim.Region.Environment.Scenes
LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb");
if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID)
{
if (m_permissionManager.GenericEstatePermission(godID))
if (Permissions.GenericEstatePermission(godID))
{
if (agentID == kickUserID)
{
@ -2896,7 +2896,7 @@ namespace OpenSim.Region.Environment.Scenes
}
else if ((parcel.landData.landFlags & (uint)Parcel.ParcelFlags.AllowGroupScripts) != 0)
{
if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || PermissionsMngr.GenericEstatePermission(part.OwnerID))
if (part.OwnerID == parcel.landData.ownerID || (parcel.landData.isGroupOwned && part.GroupID == parcel.landData.groupID) || Permissions.GenericEstatePermission(part.OwnerID))
{
return true;
}

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.BypassPermissions = bypassPermissions; });
}
private void ForEachCurrentScene(Action<Scene> func)

View File

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

View File

@ -451,7 +451,7 @@ namespace OpenSim.Region.Environment.Scenes
public uint GenerateClientFlags(LLUUID ObjectID)
{
return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID);
return m_scene.Permissions.GenerateClientFlags(m_uuid, ObjectID);
}
/// <summary>

View File

@ -180,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Common
{
m_host.AddScriptLPS(1);
//Check to make sure that the script's owner is the estate manager/master
//World.PermissionsMngr.GenericEstatePermission(
if (World.PermissionsMngr.GenericEstatePermission(m_host.OwnerID))
//World.Permissions.GenericEstatePermission(
if (World.Permissions.GenericEstatePermission(m_host.OwnerID))
{
World.EventManager.TriggerRequestChangeWaterHeight((float)height);
}
@ -2616,7 +2616,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public void llModifyLand(int action, int brush)
{
m_host.AddScriptLPS(1);
if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0)))
if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, 0)))
{
NotImplemented("llModifyLand");
}
@ -3869,7 +3869,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{
if (m_host.ObjectOwner == parcel.landData.ownerID ||
(m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID
&& parcel.landData.isGroupOwned) || World.PermissionsMngr.GenericEstatePermission(m_host.OwnerID))
&& parcel.landData.isGroupOwned) || World.Permissions.GenericEstatePermission(m_host.OwnerID))
{
av.StandUp();
}

View File

@ -258,7 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Common
if (x > 255 || x < 0 || y > 255 || y < 0)
LSLError("osTerrainSetHeight: Coordinate out of bounds");
if (World.PermissionsMngr.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0)))
if (World.Permissions.CanTerraform(m_host.OwnerID, new LLVector3(x, y, 0)))
{
World.Heightmap[x, y] = val;
return 1;
@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public int osRegionRestart(double seconds)
{
m_host.AddScriptLPS(1);
if (World.PermissionsMngr.CanRestartSim(m_host.OwnerID))
if (World.Permissions.CanRestartSim(m_host.OwnerID))
{
World.Restart((float)seconds);
return 1;
@ -406,7 +406,7 @@ namespace OpenSim.Region.ScriptEngine.Common
if (config.Configs["LL-Functions"].GetBoolean("AllowosConsoleCommand", false))
{
if (World.PermissionsMngr.CanRunConsoleCommand(m_host.OwnerID))
if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
{
MainConsole.Instance.RunCommand(command);
return true;