* Rex merge, region/environment

afrisby-3
Adam Frisby 2008-02-23 04:03:22 +00:00
parent dd96983915
commit bd57a81e76
5 changed files with 1749 additions and 1532 deletions

View File

@ -41,6 +41,8 @@ namespace OpenSim.Region.Environment
/// </summary>
public class EstateManager
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
private RegionInfo m_regInfo;
@ -156,7 +158,7 @@ namespace OpenSim.Region.Environment
{
case "getinfo":
//MainLog.Instance.Verbose("ESTATE","CLIENT--->" + packet.ToString());
//m_log.Info("[ESTATE]: CLIENT--->" + packet.ToString());
sendRegionInfoPacketToAll();
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
@ -216,12 +218,48 @@ namespace OpenSim.Region.Environment
SendEstateBlueBoxMessage(remote_client, packet);
}
break;
case "setregiondebug":
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
SetRegionDebug(remote_client, packet);
}
break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
break;
}
}
private void SetRegionDebug(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
LLUUID invoice = packet.MethodData.Invoice;
LLUUID SenderID = packet.AgentData.AgentID;
bool scripted = convertParamStringToBool(packet.ParamList[0].Parameter);
bool collisionEvents = convertParamStringToBool(packet.ParamList[1].Parameter);
bool physics = convertParamStringToBool(packet.ParamList[2].Parameter);
if (physics)
{
m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics;
}
else
{
m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics;
}
if (scripted)
{
m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts;
}
else
{
m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts;
}
m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
}
private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
LLUUID invoice = packet.MethodData.Invoice;
@ -267,7 +305,7 @@ namespace OpenSim.Region.Environment
returnblock[8].Parameter = Helpers.StringToField("1");
packet.ParamList = returnblock;
//MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
//m_log.Info("[ESTATE]: SIM--->" + packet.ToString());
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
sendEstateManagerList(remote_client, packet);
@ -306,7 +344,7 @@ namespace OpenSim.Region.Environment
returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++;
}
packet.ParamList = returnblock;
//MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
//m_log.Info("[ESTATE]: SIM--->" + packet.ToString());
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
}
@ -348,10 +386,10 @@ namespace OpenSim.Region.Environment
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString());
m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString());
break;
}
//MainLog.Instance.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString());
//m_log.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString());
}
@ -359,7 +397,7 @@ namespace OpenSim.Region.Environment
{
if (packet.ParamList.Length != 9)
{
MainLog.Instance.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
m_log.Error("EstateOwnerMessage: SetRegionInfo method has a ParamList of invalid length");
}
else
{
@ -422,22 +460,34 @@ namespace OpenSim.Region.Environment
{
if (packet.ParamList.Length != 9)
{
MainLog.Instance.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
m_log.Error("EstateOwnerMessage: SetRegionTerrain method has a ParamList of invalid length");
}
else
{
float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
float TerrainLowerLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
try
{
string tmp;
tmp = Helpers.FieldToUTF8String(packet.ParamList[0].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float WaterHeight = (float)Convert.ToDecimal(tmp);
tmp = Helpers.FieldToUTF8String(packet.ParamList[1].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float TerrainRaiseLimit = (float)Convert.ToDecimal(tmp);
tmp = Helpers.FieldToUTF8String(packet.ParamList[2].Parameter);
if (!tmp.Contains(".")) tmp += ".00";
float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
sendRegionInfoPacketToAll();
}
catch (Exception ex)
{
m_log.Error("EstateManager: Exception while setting terrain settings: \n" + packet.ToString() + "\n" + ex.ToString());
}
}
}
private void estateTextureHeightsHandler(EstateOwnerMessagePacket packet)

View File

@ -1,3 +1,31 @@
/*
* 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 System;
namespace OpenSim.Region.Environment

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -40,16 +40,16 @@ namespace OpenSim.Region.Environment
{
public class ModuleLoader
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
private Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
private readonly LogBase m_log;
private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
private readonly IConfigSource m_config;
public ModuleLoader(LogBase log, IConfigSource config)
public ModuleLoader(IConfigSource config)
{
m_log = log;
m_config = config;
}
@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment
DynamicTextureModule dynamicModule = new DynamicTextureModule();
if (m_loadedSharedModules.ContainsKey(dynamicModule.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", dynamicModule.Name, "DynamicTextureModule");
}
else
{
@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment
ChatModule chat = new ChatModule();
if (m_loadedSharedModules.ContainsKey(chat.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", chat.Name, "ChatModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", chat.Name, "ChatModule");
}
else
{
@ -98,7 +98,7 @@ namespace OpenSim.Region.Environment
InstantMessageModule imMod = new InstantMessageModule();
if (m_loadedSharedModules.ContainsKey(imMod.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", imMod.Name, "InstantMessageModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", imMod.Name, "InstantMessageModule");
}
else
{
@ -108,7 +108,7 @@ namespace OpenSim.Region.Environment
LoadImageURLModule loadMod = new LoadImageURLModule();
if (m_loadedSharedModules.ContainsKey(loadMod.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", loadMod.Name, "LoadImageURLModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", loadMod.Name, "LoadImageURLModule");
}
else
{
@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment
AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
if (m_loadedSharedModules.ContainsKey(avatarFactory.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", avatarFactory.Name, "AvarFactoryModule");
}
else
{
@ -128,14 +128,26 @@ namespace OpenSim.Region.Environment
XMLRPCModule xmlRpcMod = new XMLRPCModule();
if (m_loadedSharedModules.ContainsKey(xmlRpcMod.Name))
{
m_log.Error("MODULES", "Module name \"{0}\" already exists in module list. Module type {1} not added!", xmlRpcMod.Name, "XMLRPCModule");
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", xmlRpcMod.Name, "XMLRPCModule");
}
else
{
m_loadedSharedModules.Add(xmlRpcMod.Name, xmlRpcMod);
}
//TextureDownloadModule textureModule = new TextureDownloadModule();
//LoadedSharedModules.Add(textureModule.Name, textureModule);
AgentAssetTransactionModule transactionsModule = new AgentAssetTransactionModule();
if (m_loadedSharedModules.ContainsKey(transactionsModule.Name))
{
m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module type {1} not added!", xmlRpcMod.Name, "XMLRPCModule");
}
else
{
m_loadedSharedModules.Add(transactionsModule.Name, transactionsModule);
}
}
public void InitialiseSharedModules(Scene scene)
@ -185,17 +197,17 @@ namespace OpenSim.Region.Environment
if (modules.Length > 0)
{
m_log.Verbose("MODULES", "Found Module Library [{0}]", dllName);
m_log.InfoFormat("[MODULES]: Found Module Library [{0}]", dllName);
foreach (IRegionModule module in modules)
{
if (!module.IsSharedModule)
{
m_log.Verbose("MODULES", " [{0}]: Initializing.", module.Name);
m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name);
InitializeModule(module, scene);
}
else
{
m_log.Verbose("MODULES", " [{0}]: Loading Shared Module.", module.Name);
m_log.InfoFormat("[MODULES]: [{0}]: Loading Shared Module.", module.Name);
LoadSharedModule(module);
}
}
@ -245,7 +257,7 @@ namespace OpenSim.Region.Environment
}
catch (BadImageFormatException)
{
//m_log.Verbose("MODULES", "The file [{0}] is not a module assembly.", e.FileName);
//m_log.InfoFormat("[MODULES]: The file [{0}] is not a module assembly.", e.FileName);
}
}
@ -269,7 +281,7 @@ namespace OpenSim.Region.Environment
}
catch (ReflectionTypeLoadException)
{
m_log.Verbose("MODULES", "Could not load types for [{0}].", pluginAssembly.FullName);
m_log.InfoFormat("[MODULES]: Could not load types for [{0}].", pluginAssembly.FullName);
}
}
@ -293,5 +305,12 @@ namespace OpenSim.Region.Environment
{
LoadedAssemblys.Clear();
}
public void UnloadModule(IRegionModule rm)
{
rm.Close();
m_loadedModules.Remove(rm);
}
}
}

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -37,11 +37,12 @@ namespace OpenSim.Region.Environment
protected Scene m_scene;
// These are here for testing. They will be taken out
private uint PERM_ALL = (uint) 2147483647;
private uint PERM_COPY = (uint) 32768;
private uint PERM_MODIFY = (uint) 16384;
private uint PERM_MOVE = (uint) 524288;
private uint PERM_TRANS = (uint) 8192;
private uint PERM_ALL = (uint)2147483647;
private uint PERM_COPY = (uint)32768;
private uint PERM_MODIFY = (uint)16384;
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
@ -80,22 +81,35 @@ namespace OpenSim.Region.Environment
return true;
}
// If there is no master avatar, return false
if (m_scene.RegionInfo.MasterAvatarAssignedUUID != null)
{
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
}
return false;
}
public virtual bool IsEstateManager(LLUUID user)
{
if (m_bypassPermissions)
{
return true;
}
if (user != null)
{
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
for (int i = 0; i < estatemanagers.Length; i++)
{
if (estatemanagers[i] == user)
return true;
}
}
// The below is commented out because logically it happens anyway. It's left in for readability
//else
//{
//return false;
//}
return false;
}
@ -119,8 +133,8 @@ namespace OpenSim.Region.Environment
Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) ==
(int) Parcel.ParcelFlags.CreateObjects)
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
(int)Parcel.ParcelFlags.CreateObjects)
permission = true;
//TODO: check for group rights
@ -153,6 +167,18 @@ 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.
// So, that means that all of the permissions type ObjectFlags are /temporary/ and only
// supposed to be set when customizing the objectflags for the client.
// These temporary objectflags get computed and added in this function based on the
// Permission mask that's appropriate!
// Outside of this method, they should never be added to objectflags!
// -teravus
if (!m_scene.Entities.ContainsKey(objID))
{
return 0;
@ -164,20 +190,42 @@ namespace OpenSim.Region.Environment
return 0;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objID];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objID];
LLUUID objectOwner = task.OwnerID;
//return task.RootPart.ObjectFlags;task.RootPart.ObjectFlags |
uint objflags = task.RootPart.ObjectFlags;
uint OwnerMask = task.RootPart.ObjectFlags | task.RootPart.OwnerMask;
uint GroupMask = task.RootPart.ObjectFlags | task.RootPart.GroupMask;
uint EveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask;
// Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code
objflags &= (uint)
~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
LLObject.ObjectFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
);
// Creating the three ObjectFlags options for this method to choose from.
// Customize the OwnerMask
uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags);
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
// Customize the GroupMask
uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags);
// Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
objectEveryoneMask |= (uint)LLObject.ObjectFlags.ObjectModify;
if (m_bypassPermissions)
return OwnerMask;
return objectOwnerMask;
else //rex
{
EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectModify;
@ -185,45 +233,68 @@ namespace OpenSim.Region.Environment
// Object owners should be able to edit their own content
if (user == objectOwner)
return OwnerMask;
{
return objectOwnerMask;
}
// Users should be able to edit what is over their land.
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
return OwnerMask;
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(objectOwner))
return objectEveryoneMask;
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
return OwnerMask;
return objectOwnerMask;
// Admin objects should not be editable by the above
if (IsAdministrator(taskOwner))
return EveryoneMask;
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
return OwnerMask;
return objectOwnerMask;
if (((EveryoneMask & PERM_MOVE) != 0) || ((EveryoneMask & PERM_COPY) != 0))
return objectEveryoneMask;
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
{
if ((EveryoneMask & PERM_MOVE) != 0)
OwnerMask &= ~PERM_MOVE;
// We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client.
if ((EveryoneMask & PERM_COPY) != 0)
OwnerMask &= ~PERM_COPY;
OwnerMask &= ~PERM_MODIFY;
OwnerMask &= ~PERM_TRANS;
return OwnerMask;
}
return EveryoneMask;
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
}
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId)
if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
}
if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
}
if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
{
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
}
return objectFlagsMask;
}
protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
{
// Default: deny
bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId))
{
@ -231,37 +302,59 @@ namespace OpenSim.Region.Environment
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[objId] is SceneObjectGroup))
if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objId];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content
if (user == objectOwner)
if (currentUser == objectOwner)
{
permission = true;
}
// Users should be able to edit what is over their land.
Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
if (parcel != null && parcel.landData.ownerID == user)
Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
if ((parcel != null) && (parcel.landData.ownerID == currentUser))
{
permission = true;
}
// Estate users should be able to edit anything in the sim
if (IsEstateManager(user))
if (IsEstateManager(currentUser))
{
permission = true;
}
// Admin objects should not be editable by the above
if (IsAdministrator(taskOwner))
if (IsAdministrator(objectOwner))
{
permission = false;
}
// Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user))
if (IsAdministrator(currentUser))
{
permission = true;
}
return permission;
}
@ -292,19 +385,33 @@ namespace OpenSim.Region.Environment
return false;
}
// The client
// may request to edit linked parts, and therefore, it needs
// to also check for SceneObjectPart
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) != 0)
permission = false;
}
return permission;
}
@ -325,7 +432,7 @@ namespace OpenSim.Region.Environment
return false;
}
SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID taskOwner = null;
// Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect.
@ -392,6 +499,11 @@ namespace OpenSim.Region.Environment
return IsAdministrator(user);
}
public virtual bool CanRunConsoleCommand(LLUUID user)
{
return IsAdministrator(user);
}
public virtual bool CanTerraform(LLUUID user, LLVector3 position)
{
bool permission = false;
@ -463,7 +575,9 @@ namespace OpenSim.Region.Environment
bool permission = false;
if (parcel.landData.ownerID == user)
{
permission = true;
}
if (parcel.landData.isGroupOwned)
{
@ -471,10 +585,14 @@ namespace OpenSim.Region.Environment
}
if (IsEstateManager(user))
{
permission = true;
}
if (IsAdministrator(user))
{
permission = true;
}
return permission;
}

View File

@ -13,7 +13,7 @@
* 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
* 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
@ -35,6 +35,8 @@ namespace OpenSim.Region.Environment
{
public class StorageManager
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private IRegionDataStore m_dataStore;
public IRegionDataStore DataStore
@ -47,9 +49,9 @@ namespace OpenSim.Region.Environment
m_dataStore = storage;
}
public StorageManager(string dllName, string connectionstring)
public StorageManager(string dllName, string connectionstring, bool persistPrimInventories)
{
MainLog.Instance.Verbose("DATASTORE", "Attempting to load " + dllName);
m_log.Info("[DATASTORE]: Attempting to load " + dllName);
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
foreach (Type pluginType in pluginAssembly.GetTypes())
@ -62,11 +64,11 @@ namespace OpenSim.Region.Environment
{
IRegionDataStore plug =
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connectionstring, false);
plug.Initialise(connectionstring, persistPrimInventories);
m_dataStore = plug;
MainLog.Instance.Verbose("DATASTORE", "Added IRegionDataStore Interface");
m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
}
}
}