*Complete redo of the permissions module

*Removed hardcoded permissions checks
*Added permissions checks where needed
0.6.0-stable
mingchen 2008-05-13 16:22:57 +00:00
parent 8293be6811
commit 32785921d0
15 changed files with 887 additions and 641 deletions

View File

@ -500,6 +500,8 @@ namespace OpenSim.Framework
public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
public delegate void ParcelAbandonRequest(int local_id, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(LLUUID AgentID, LLUUID SessionID, LLUUID TransactionID, LLUUID Invoice, byte[] Method, byte[][] Parameters, IClientAPI remote_client);
public delegate void RegionInfoRequest(IClientAPI remote_client);
@ -762,6 +764,7 @@ namespace OpenSim.Framework
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
event ParcelSelectObjects OnParcelSelectObjects;
event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
event ParcelAbandonRequest OnParcelAbandonRequest;
event RegionInfoRequest OnRegionInfoRequest;
event EstateCovenantRequest OnEstateCovenantRequest;

View File

@ -244,7 +244,6 @@ namespace OpenSim
m_console.Notice("force-update - force an update of prims in the scene");
m_console.Notice("load-xml [filename] - load prims from XML");
m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
m_console.Notice("permissions [true/false] - turn on/off permissions on the scene");
m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
m_console.Notice("remove-region [name] - remove a region");
m_console.Notice("save-xml [filename] - save prims to XML");
@ -368,12 +367,6 @@ namespace OpenSim
}
break;
case "permissions":
// Treats each user as a super-admin when disabled
bool permissions = Convert.ToBoolean(cmdparams[0]);
m_sceneManager.SetBypassPermissionsOnCurrentScene(!permissions);
break;
case "backup":
m_sceneManager.BackupCurrentScene();
break;
@ -538,7 +531,6 @@ namespace OpenSim
}
break;
default:
string[] tmpPluginArgs = new string[cmdparams.Length + 1];
cmdparams.CopyTo(tmpPluginArgs, 1);

View File

@ -217,6 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private ParcelPropertiesUpdateRequest handlerParcelPropertiesUpdateRequest = null; //OnParcelPropertiesUpdateRequest;
private ParcelSelectObjects handlerParcelSelectObjects = null; //OnParcelSelectObjects;
private ParcelObjectOwnerRequest handlerParcelObjectOwnerRequest = null; //OnParcelObjectOwnerRequest;
private ParcelAbandonRequest handlerParcelAbandonRequest = null;
private RegionInfoRequest handlerRegionInfoRequest = null; //OnRegionInfoRequest;
private EstateCovenantRequest handlerEstateCovenantRequest = null; //OnEstateCovenantRequest;
private RequestGodlikePowers handlerReqGodlikePowers = null; //OnRequestGodlikePowers;
@ -791,6 +792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest;
public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest;
@ -944,6 +946,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp,
byte[] binaryBucket)
{
if (((Scene)(this.m_scene)).ExternalChecks.ExternalChecksCanInstantMessage(fromAgent, toAgent))
{
ImprovedInstantMessagePacket msg
= (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
@ -965,6 +969,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(msg, ThrottleOutPacketType.Task);
}
}
/// <summary>
/// Send the region heightmap to the client
@ -5254,7 +5259,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerParcelObjectOwnerRequest(reqPacket.ParcelData.LocalID, this);
}
break;
case PacketType.ParcelRelease:
ParcelReleasePacket releasePacket = (ParcelReleasePacket)Pack;
handlerParcelAbandonRequest = OnParcelAbandonRequest;
if (handlerParcelAbandonRequest != null)
{
handlerParcelAbandonRequest(releasePacket.Data.LocalID, this);
}
break;
#endregion
#region Estate Packets
@ -5267,13 +5280,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
case "getinfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
}
break;
case "setregioninfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter),convertParamStringToBool(messagePacket.ParamList[1].Parameter),
convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
@ -5286,7 +5299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "texturebase":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5301,7 +5314,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "texturedetail":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5319,7 +5332,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "textureheights":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5340,7 +5353,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OnCommitEstateTerrainTextureRequest(this);
break;
case "setregionterrain":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
if (messagePacket.ParamList.Length != 9)
{
@ -5375,7 +5388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break;
case "restart":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanRestartSim(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(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)
@ -5389,7 +5402,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "estatechangecovenantid":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanEditEstateTerrain(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{
@ -5399,7 +5412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(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)));
@ -5407,7 +5420,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "simulatormessage":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@ -5418,7 +5431,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "instantmessage":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@ -5429,7 +5442,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "setregiondebug":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID;
@ -5441,7 +5454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
break;
case "teleporthomeuser":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanBeGodLike(this.AgentId))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID;

View File

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

View File

@ -400,7 +400,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
//If we are still here, then they are subdividing within one piece of land
//Check owner
if (startLandObject.landData.ownerID != attempting_user_id)
if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id,startLandObject))
{
return;
}
@ -469,7 +469,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
return;
}
if (masterLandObject.landData.ownerID != attempting_user_id)
if (!m_scene.ExternalChecks.ExternalChecksCanEditParcel(attempting_user_id, masterLandObject))
{
return;
}
@ -655,6 +655,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void handleParcelSelectObjectsRequest(int local_id, int request_type, IClientAPI remote_client)
{
landList[local_id].sendForceObjectSelect(local_id, request_type, remote_client);
}
@ -663,6 +664,18 @@ namespace OpenSim.Region.Environment.Modules.World.Land
landList[local_id].sendLandObjectOwners(remote_client);
}
public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client)
{
if (landList.ContainsKey(local_id))
{
if (m_scene.ExternalChecks.ExternalChecksCanAbandonParcel(remote_client.AgentId, landList[local_id]))
{
landList[local_id].landData.ownerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
m_scene.Broadcast(SendParcelOverlay);
}
}
}
#endregion
#region ILandChannel Members

View File

@ -52,7 +52,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
m_scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
m_scene.EventManager.OnSignificantClientMovement += landChannel.handleSignificantClientMovement;
lock (m_scene)
{
m_scene.LandChannel = (ILandChannel) landChannel;
@ -70,8 +69,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
client.OnParcelObjectOwnerRequest += new ParcelObjectOwnerRequest(landChannel.handleParcelObjectOwnersRequest);
client.OnParcelAccessListRequest += new ParcelAccessListRequest(landChannel.handleParcelAccessRequest);
client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(landChannel.handleParcelAccessUpdateRequest);
client.OnParcelAbandonRequest += new ParcelAbandonRequest(landChannel.handleParcelAbandonRequest);
}
public void PostInitialise()
{
}

View File

@ -127,12 +127,19 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
{
if (remote_client.AgentId == landData.ownerID)
if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId,this))
{
//Needs later group support
LandData newData = landData.Copy();
if (args.AuthBuyerID != newData.authBuyerID || args.SalePrice != newData.salePrice)
{
if (m_scene.ExternalChecks.ExternalChecksCanSellParcel(remote_client.AgentId, this))
{
newData.authBuyerID = args.AuthBuyerID;
newData.salePrice = args.SalePrice;
}
}
newData.category = args.Category;
newData.landDesc = args.Desc;
newData.groupID = args.GroupID;
@ -145,7 +152,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land
newData.landFlags = args.ParcelFlags;
newData.passHours = args.PassHours;
newData.passPrice = args.PassPrice;
newData.salePrice = args.SalePrice;
newData.snapshotID = args.SnapshotID;
newData.userLocation = args.UserLocation;
newData.userLookAt = args.UserLookAt;
@ -586,6 +592,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#region Object Select and Object Owner Listing
public void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client)
{
if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
{
List<uint> resultLocalIDs = new List<uint>();
foreach (SceneObjectGroup obj in primsOverMe)
@ -609,6 +617,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
remote_client.sendForceClientSelectObjects(resultLocalIDs);
}
}
/// <summary>
/// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes
@ -619,6 +628,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
/// A <see cref="IClientAPI"/>
/// </param>
public void sendLandObjectOwners(IClientAPI remote_client)
{
if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
{
Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
@ -647,6 +658,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
remote_client.sendLandObjectOwners(primCount);
}
}
public Dictionary<LLUUID, int> getLandObjectOwners()
{

View File

@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;

View File

@ -27,16 +27,23 @@
using libsecondlife;
using Nini.Config;
using System;
using System.Reflection;
using log4net;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.Framework;
using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.World.Permissions
{
public class PermissionsModule : IRegionModule, IScenePermissions
public class PermissionsModule : IRegionModule, IScenePermissions, ICommandableModule
{
protected Scene m_scene;
private readonly Commander m_commander = new Commander("Permissions");
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region Constants
// These are here for testing. They will be taken out
//private uint PERM_ALL = (uint)2147483647;
@ -46,15 +53,88 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
//private uint PERM_TRANS = (uint)8192;
private uint PERM_LOCKED = (uint)540672;
#endregion
#region Bypass Permissions / Debug Permissions Stuff
// Bypasses the permissions engine
private bool m_bypassPermissions = false;
private bool m_bypassPermissionsValue = true;
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
#region ICommandableModule Members
public ICommander CommandInterface
{
get { throw new System.NotImplementedException(); }
}
private void InterfaceDebugPermissions(Object[] args)
{
if ((bool)args[0] == true)
{
m_debugPermissions = true;
m_log.Info("[PERMISSIONS]: Permissions Debugging Enabled.");
}
else
{
m_debugPermissions = false;
m_log.Info("[PERMISSIONS]: Permissions Debugging Disabled.");
}
}
private void InterfaceBypassPermissions(Object[] args)
{
if ((bool)args[0] == true)
{
m_log.Info("[PERMISSIONS]: Permissions Bypass Enabled.");
m_bypassPermissionsValue = (bool)args[1];
}
else
{
m_bypassPermissions = false;
m_log.Info("[PERMISSIONS]: Permissions Bypass Disabled. Normal Operation.");
}
}
/// <summary>
/// Processes commandline input. Do not call directly.
/// </summary>
/// <param name="args">Commandline arguments</param>
private void EventManager_OnPluginConsole(string[] args)
{
if (args[0] == "permissions")
{
string[] tmpArgs = new string[args.Length - 2];
int i;
for (i = 2; i < args.Length; i++)
tmpArgs[i - 2] = args[i];
m_commander.ProcessConsoleCommand(args[1], tmpArgs);
}
}
#endregion
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@ -67,29 +147,52 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
m_scene.RegisterModuleInterface<IScenePermissions>(this);
//Register External Permission Checks!
m_scene.ExternalChecks.addCheckAbandonParcel(this.CanAbandonParcel);
m_scene.ExternalChecks.addCheckCopyObject(this.CanCopyObject);
m_scene.ExternalChecks.addCheckDeRezObject(this.CanDeRezObject);
m_scene.ExternalChecks.addCheckEditEstateTerrain(this.CanEditEstateTerrain);
m_scene.ExternalChecks.addCheckEditObject(this.CanEditObject);
m_scene.ExternalChecks.addCheckEditParcel(this.CanEditParcel);
m_scene.ExternalChecks.addCheckEditScript(this.CanEditScript);
m_scene.ExternalChecks.addCheckInstantMessage(this.CanInstantMessage);
m_scene.ExternalChecks.addCheckInventoryTransfer(this.CanInventoryTransfer);
m_scene.ExternalChecks.addCheckMoveObject(this.CanEditObjectPosition);
m_scene.ExternalChecks.addCheckRestartSim(this.CanRestartSim);
m_scene.ExternalChecks.addCheckReturnObject(this.CanReturnObject);
m_scene.ExternalChecks.addCheckRezObject(this.CanRezObject);
m_scene.ExternalChecks.addCheckBeGodLike(this.CanBeGodLike);
m_scene.ExternalChecks.addCheckRunConsoleCommand(this.CanRunConsoleCommand);
m_scene.ExternalChecks.addCheckRunScript(this.CanRunScript);
m_scene.ExternalChecks.addCheckSellParcel(this.CanSellParcel);
//m_scene.ExternalChecks.addCheckTakeObject; -- NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckTerraformLandCommand(this.CanTerraform);
//Register functions with Scene External Checks!
m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckDuplicateObject(CanDuplicateObject); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckDeleteObject(CanDeleteObject); //MAYBE FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckMoveObject(CanMoveObject); //HOPEFULLY FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckObjectEntry(CanObjectEntry); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckReturnObject(CanReturnObject); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckRezObject(CanRezObject); //HOPEFULLY FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckRunConsoleCommand(CanRunConsoleCommand); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckRunScript(CanRunScript); //NOT YET IMPLEMENTED
m_scene.ExternalChecks.addCheckSellParcel(CanSellParcel); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckTakeObject(CanTakeObject); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED
m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!)
m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED
//NEEDED PERMS:
//CanLinkObject
//CanDelinkObject
//CanBuyLand
//Register Debug Commands
Command bypassCommand = new Command("bypass", InterfaceBypassPermissions, "Force the permissions a specific way to test permissions");
bypassCommand.AddArgument("enable_bypass_perms", "true to enable bypassing all perms", "Boolean");
bypassCommand.AddArgument("bypass_perms_value", "true/false: true will ignore all perms; false will restrict everything", "Boolean");
m_commander.RegisterCommand("bypass", bypassCommand);
Command debugCommand = new Command("debug", InterfaceDebugPermissions, "Force the permissions a specific way to test permissions");
debugCommand.AddArgument("enable_debug_perms", "true to enable debugging to console all perms", "Boolean");
m_commander.RegisterCommand("debug", debugCommand);
m_scene.RegisterModuleCommander("CommanderPermissions", m_commander);
m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole);
}
public void PostInitialise()
{
}
@ -110,18 +213,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
#endregion
#region Helper Functions
protected void SendPermissionError(LLUUID user, string reason)
{
m_scene.EventManager.TriggerPermissionError(user, reason);
}
protected void DebugPermissionInformation(string permissionCalled)
{
if(m_debugPermissions)
m_log.Info("[PERMISSIONS]: " + permissionCalled + " was called from " + m_scene.RegionInfo.RegionName);
}
protected bool IsAdministrator(LLUUID user)
{
if (m_bypassPermissions)
{
return true;
}
// If there is no master avatar, return false
if (m_scene.RegionInfo.MasterAvatarAssignedUUID != LLUUID.Zero)
{
@ -133,117 +237,19 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
protected bool IsEstateManager(LLUUID user)
{
if (m_bypassPermissions)
{
return true;
}
if (user != LLUUID.Zero)
{
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
for (int i = 0; i < estatemanagers.Length; i++)
foreach(LLUUID estatemanager in estatemanagers)
{
if (estatemanagers[i] == user)
if (estatemanager == user)
return true;
}
}
return false;
}
protected bool IsGridUser(LLUUID user)
{
return true;
}
protected bool IsGuest(LLUUID user)
{
return false;
}
public bool CanRezObject(int objectCount, LLUUID user, LLVector3 position,Scene scene)
{
bool permission = false;
string reason = "Insufficient permission";
ILandObject land = m_scene.LandChannel.GetLandObject(position.X, position.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
(int)Parcel.ParcelFlags.CreateObjects)
permission = true;
//TODO: check for group rights
if (IsAdministrator(user))
{
permission = true;
}
else
{
reason = "Not an administrator";
}
if (GenericParcelPermission(user, position))
{
permission = true;
}
else
{
reason = "Not the parcel owner";
}
if (!permission)
SendPermissionError(user, reason);
return permission;
}
/// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
public bool CanObjectEntry(LLUUID user, LLVector3 oldPos, LLVector3 newPos)
{
if ((newPos.X > 257f || newPos.X < -1f || newPos.Y > 257f || newPos.Y < -1f))
{
return true;
}
ILandObject land1 = m_scene.LandChannel.GetLandObject(oldPos.X, oldPos.Y);
ILandObject land2 = m_scene.LandChannel.GetLandObject(newPos.X, newPos.Y);
if (land1 == null || land2 == null)
{
return false;
}
if (land2 == null)
{
// need this for crossing borders
return true;
}
if (land1.landData.globalID == land2.landData.globalID)
{
return true;
}
if ((land2.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
{
return true;
}
//TODO: check for group rights
if (GenericParcelPermission(user, newPos))
{
return true;
}
SendPermissionError(user, "Not allowed to move objects in this parcel!");
return false;
}
#endregion
#region Object Permissions
@ -427,143 +433,16 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return permission;
}
/// <see cref="Opensim.Region.Environment.Interfaces.IScenePermissions></see>
public bool CanDeRezObject(LLUUID obj,LLUUID user, Scene scene)
{
return GenericObjectPermission(user, obj);
}
public bool CanEditObject(LLUUID obj, LLUUID user, Scene scene)
{
return GenericObjectPermission(user, obj);
}
public bool CanEditObjectPosition(LLUUID obj, LLUUID user, Scene scene)
{
bool permission = GenericObjectPermission(user, obj);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
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)))
{
return false;
}
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;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[obj];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (user == objectOwner))
return false;
}
return permission;
}
public bool CanCopyObject(int objectCount, LLUUID obj, LLUUID user, Scene scene, LLVector3 objectPosition)
{
bool permission = GenericObjectPermission(user, obj);
if (permission)
{
if (!m_scene.Entities.ContainsKey(obj))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[obj] is SceneObjectGroup))
{
return false;
}
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;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
public bool CanReturnObject(LLUUID obj, LLUUID user, Scene scene)
{
return GenericObjectPermission(user, obj);
}
#endregion
#region Communication Permissions
#region Generic Permissions
protected bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{
bool permission = false;
string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user))
permission = true;
if (!IsGridUser(user))
{
permission = false;
reason = "The person that you are messaging is not a registered user.";
}
if (IsAdministrator(user))
permission = true;
@ -576,66 +455,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return permission;
}
public bool CanInstantMessage(LLUUID user, LLUUID target, Scene scene)
{
return GenericCommunicationPermission(user, target);
}
public bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene scene)
{
return GenericCommunicationPermission(user, target);
}
#endregion
public bool CanEditScript(LLUUID script, LLUUID user, Scene scene)
{
return IsAdministrator(user);
}
public bool CanRunScript(LLUUID script, LLUUID user, Scene scene)
{
return IsAdministrator(user);
}
public bool CanRunConsoleCommand(LLUUID user, Scene scene)
{
return IsAdministrator(user);
}
public bool CanTerraform(LLUUID user, LLVector3 position, Scene scene)
{
bool permission = false;
// Estate override
if (GenericEstatePermission(user))
permission = true;
float X = position.X;
float Y = position.Y;
if (X > 255)
X = 255;
if (Y > 255)
Y = 255;
if (X < 0)
X = 0;
if (Y < 0)
Y = 0;
// Land owner can terraform too
ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
if (parcel != null && GenericParcelPermission(user, parcel))
permission = true;
if (!permission)
SendPermissionError(user, "Not authorized to terraform at this location.");
return permission;
}
#region Estate Permissions
public bool GenericEstatePermission(LLUUID user)
{
// Default: deny
@ -652,28 +471,6 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return permission;
}
public bool CanEditEstateTerrain(LLUUID user, Scene scene)
{
return GenericEstatePermission(user);
}
public bool CanRestartSim(LLUUID user, Scene scene)
{
// Since this is potentially going on a grid...
return GenericEstatePermission(user);
//return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
}
public bool CanBeGodLike(LLUUID user, Scene scene)
{
return GenericEstatePermission(user);
}
#endregion
#region Parcel Permissions
protected bool GenericParcelPermission(LLUUID user, ILandObject parcel)
{
bool permission = false;
@ -707,22 +504,365 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
if (parcel == null) return false;
return GenericParcelPermission(user, parcel);
}
public bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene)
{
return GenericParcelPermission(user, parcel);
}
public bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene)
{
return GenericParcelPermission(user, parcel);
}
public bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene)
{
return GenericParcelPermission(user, parcel);
}
#endregion
#region Permission Checks
private bool CanAbandonParcel(LLUUID user, ILandObject parcel, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericParcelPermission(user, parcel);
}
private bool CanBeGodLike(LLUUID user, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return IsAdministrator(user);
}
private bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
if (!GenericObjectPermission(owner, objectID))
{
//They can't even edit the object
return false;
}
//If they can rez, they can duplicate
return CanRezObject(objectCount, owner, objectPosition, scene);
}
private bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(objectID, deleter);
}
private bool CanEditObject(LLUUID objectID, LLUUID editorID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(editorID, objectID);
}
private bool CanEditParcel(LLUUID user, ILandObject parcel, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericParcelPermission(user, parcel);
}
private bool CanEditScript(LLUUID script, LLUUID user, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return true;
}
private bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericCommunicationPermission(user, target);
}
private bool CanInventoryTransfer(LLUUID user, LLUUID target, Scene startScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericCommunicationPermission(user, target);
}
private bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericEstatePermission(user);
}
private bool CanMoveObject(LLUUID objectID, LLUUID moverID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
bool permission = GenericObjectPermission(moverID, objectID);
if (!permission)
{
if (!m_scene.Entities.ContainsKey(objectID))
{
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[objectID] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
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;
}
else
{
bool locked = false;
if (!m_scene.Entities.ContainsKey(objectID))
{
return false;
}
// If it's not an object, we cant edit it.
if ((!(m_scene.Entities[objectID] is SceneObjectGroup)))
{
return false;
}
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objectID];
LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// This is an exception to the generic object permission.
// Administrators who lock their objects should not be able to move them,
// however generic object permission should return true.
// This keeps locked objects from being affected by random click + drag actions by accident
// and allows the administrator to grab or delete a locked object.
// Administrators and estate managers are still able to click+grab locked objects not
// owned by them in the scene
// This is by design.
if (locked && (moverID == objectOwner))
return false;
}
return permission;
}
private bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
if ((newPoint.X > 257f || newPoint.X < -1f || newPoint.Y > 257f || newPoint.Y < -1f))
{
return true;
}
ILandObject land = m_scene.LandChannel.GetLandObject(newPoint.X, newPoint.Y);
if (land == null)
{
return false;
}
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.AllowAllObjectEntry)) != 0)
{
return true;
}
//TODO: check for group rights
if (!m_scene.Entities.ContainsKey(objectID))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[objectID] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
if (GenericParcelPermission(task.OwnerID, newPoint))
{
return true;
}
//Otherwise, false!
return false;
}
private bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(returnerID, objectID);
}
private bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
bool permission = false;
ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
if (land == null) return false;
if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
(int)Parcel.ParcelFlags.CreateObjects)
permission = true;
//TODO: check for group rights
if (IsAdministrator(owner))
{
permission = true;
}
if (GenericParcelPermission(owner, objectPosition))
{
permission = true;
}
return permission;
}
private bool CanRunConsoleCommand(LLUUID user, Scene requestFromScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return IsAdministrator(user);
}
private bool CanRunScript(LLUUID script, LLUUID user, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return true;
}
private bool CanSellParcel(LLUUID user, ILandObject parcel, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericParcelPermission(user, parcel);
}
private bool CanTakeObject(LLUUID objectID, LLUUID stealer, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return GenericObjectPermission(stealer,objectID);
}
private bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
bool permission = GenericObjectPermission(userID, objectID);
if (permission)
{
if (!m_scene.Entities.ContainsKey(objectID))
{
return false;
}
// If it's not an object, we cant edit it.
if (!(m_scene.Entities[objectID] is SceneObjectGroup))
{
return false;
}
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objectID];
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;
if ((task.RootPart.EveryoneMask & PERM_COPY) != 0)
permission = true;
}
return permission;
}
private bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
bool permission = false;
// Estate override
if (GenericEstatePermission(user))
permission = true;
float X = position.X;
float Y = position.Y;
if (X > 255)
X = 255;
if (Y > 255)
Y = 255;
if (X < 0)
X = 0;
if (Y < 0)
Y = 0;
// Land owner can terraform too
ILandObject parcel = m_scene.LandChannel.GetLandObject(X, Y);
if (parcel != null && GenericParcelPermission(user, parcel))
permission = true;
return permission;
}
private bool CanViewScript(LLUUID script, LLUUID user, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
return true;
}
#endregion
}
}

View File

@ -287,9 +287,12 @@ namespace OpenSim.Region.Environment.Scenes
if (obj is SceneObjectGroup)
{
if (((SceneObjectGroup)obj).LocalId == localID)
{
if (m_parentScene.ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)obj).UUID, avatar_deleter))
{
m_parentScene.RemoveEntity((SceneObjectGroup)obj);
m_numPrim--;
}
return;
}
}
@ -998,12 +1001,11 @@ namespace OpenSim.Region.Environment.Scenes
if (group != null)
{
LLVector3 oldPos = group.AbsolutePosition;
//FIXME: ObjectEntry is not in ExternalChecks!
//if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
//{
if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
//return;
//}
return;
}
if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(remoteClient.AgentId, group.UUID) || group.RootPart.m_IsAttachment)
{
group.UpdateSinglePosition(pos, localID);
@ -1030,12 +1032,11 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
//FIXME: ObjectEntry not in ExternalChecks!
//if (!m_parentScene.Permissions.CanObjectEntry(remoteClient.AgentId, oldPos, pos) && !group.RootPart.m_IsAttachment)
//{
if (!m_parentScene.ExternalChecks.ExternalChecksCanObjectEntry(group.UUID,pos) && !group.RootPart.m_IsAttachment)
{
group.SendGroupTerseUpdate();
// return;
//}
return;
}
if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID, remoteClient.AgentId) || group.RootPart.m_IsAttachment)
{
group.UpdateGroupPosition(pos);
@ -1055,7 +1056,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null)
{
if (m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(group.UUID,remoteClient.AgentId))
if (m_parentScene.ExternalChecks.ExternalChecksCanEditObject(group.UUID,remoteClient.AgentId))
{
group.UpdateTextureEntry(localID, texture);
}
@ -1378,7 +1379,7 @@ namespace OpenSim.Region.Environment.Scenes
if (originPrim != null)
{
if (m_parentScene.ExternalChecks.ExternalChecksCanCopyObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition))
if (m_parentScene.ExternalChecks.ExternalChecksCanDuplicateObject(originPrim.Children.Count, originPrim.UUID, AgentID, originPrim.AbsolutePosition))
{
SceneObjectGroup copy = originPrim.Copy(AgentID, GroupID);
copy.AbsolutePosition = copy.AbsolutePosition + offset;

View File

@ -988,17 +988,28 @@ namespace OpenSim.Region.Environment.Scenes
}
if (selectedEnt != null)
{
bool permission;
if (DeRezPacket.AgentBlock.Destination == 1)
{ // Take Copy
permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
bool permissionToTake = false;
bool permissionToDelete = false;
if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy
{
permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = false; //Just taking copy!
}
else
{ // Take
permission = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
else if(DeRezPacket.AgentBlock.Destination == 4) //Take
{
// Take
permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
permissionToDelete = permissionToTake; //If they can take, they can delete!
}
if (permission)
else if (DeRezPacket.AgentBlock.Destination == 6) //Delete
{
permissionToTake = false;
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
}
if (permissionToTake)
{
SceneObjectGroup objectGroup = (SceneObjectGroup) selectedEnt;
string sceneObjectXml = objectGroup.ToXmlString();
@ -1044,8 +1055,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendInventoryItemCreateUpdate(item);
}
// FIXME: Nasty hardcoding. If Destination is 1 then client wants us to take a copy
if (DeRezPacket.AgentBlock.Destination != 1)
if (permissionToDelete)
{
DeleteSceneObjectGroup(objectGroup);
}

View File

@ -1146,6 +1146,8 @@ namespace OpenSim.Region.Environment.Scenes
m_log.Info("[SCENE]: Loading land objects from storage");
List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID);
if (LandChannel != null)
{
if (landData.Count == 0)
{
LandChannel.NoLandDataFromStorage();
@ -1155,6 +1157,11 @@ namespace OpenSim.Region.Environment.Scenes
LandChannel.IncomingLandObjectsFromStorage(landData);
}
}
else
{
m_log.Error("[SCENE]: Land Channel is not defined. Cannot load from storage!");
}
}
#endregion

View File

@ -74,24 +74,24 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region DEREZ OBJECT
public delegate bool CanDeRezObject(LLUUID objectID, LLUUID deleter, Scene scene);
private List<CanDeRezObject> CanDeRezObjectCheckFunctions = new List<CanDeRezObject>();
#region DELETE OBJECT
public delegate bool CanDeleteObject(LLUUID objectID, LLUUID deleter, Scene scene);
private List<CanDeleteObject> CanDeleteObjectCheckFunctions = new List<CanDeleteObject>();
public void addCheckDeRezObject(CanDeRezObject delegateFunc)
public void addCheckDeleteObject(CanDeleteObject delegateFunc)
{
if (!CanDeRezObjectCheckFunctions.Contains(delegateFunc))
CanDeRezObjectCheckFunctions.Add(delegateFunc);
if (!CanDeleteObjectCheckFunctions.Contains(delegateFunc))
CanDeleteObjectCheckFunctions.Add(delegateFunc);
}
public void removeCheckDeRezObject(CanDeRezObject delegateFunc)
public void removeCheckDeleteObject(CanDeleteObject delegateFunc)
{
if (CanDeRezObjectCheckFunctions.Contains(delegateFunc))
CanDeRezObjectCheckFunctions.Remove(delegateFunc);
if (CanDeleteObjectCheckFunctions.Contains(delegateFunc))
CanDeleteObjectCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanDeRezObject(LLUUID objectID, LLUUID deleter)
public bool ExternalChecksCanDeleteObject(LLUUID objectID, LLUUID deleter)
{
foreach (CanDeRezObject check in CanDeRezObjectCheckFunctions)
foreach (CanDeleteObject check in CanDeleteObjectCheckFunctions)
{
if (check(objectID,deleter,m_scene) == false)
{
@ -132,24 +132,53 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region COPY OBJECT
public delegate bool CanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
private List<CanCopyObject> CanCopyObjectCheckFunctions = new List<CanCopyObject>();
#region TAKE COPY OBJECT
public delegate bool CanTakeCopyObject(LLUUID objectID, LLUUID userID, Scene inScene);
private List<CanTakeCopyObject> CanTakeCopyObjectCheckFunctions = new List<CanTakeCopyObject>();
public void addCheckCopyObject(CanCopyObject delegateFunc)
public void addCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
{
if (!CanCopyObjectCheckFunctions.Contains(delegateFunc))
CanCopyObjectCheckFunctions.Add(delegateFunc);
if (!CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
CanTakeCopyObjectCheckFunctions.Add(delegateFunc);
}
public void removeCheckCopyObject(CanCopyObject delegateFunc)
public void removeCheckTakeCopyObject(CanTakeCopyObject delegateFunc)
{
if (CanCopyObjectCheckFunctions.Contains(delegateFunc))
CanCopyObjectCheckFunctions.Remove(delegateFunc);
if (CanTakeCopyObjectCheckFunctions.Contains(delegateFunc))
CanTakeCopyObjectCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanCopyObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
public bool ExternalChecksCanTakeCopyObject(LLUUID objectID, LLUUID userID)
{
foreach (CanCopyObject check in CanCopyObjectCheckFunctions)
foreach (CanTakeCopyObject check in CanTakeCopyObjectCheckFunctions)
{
if (check(objectID,userID,m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region DUPLICATE OBJECT
public delegate bool CanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, Scene scene, LLVector3 objectPosition);
private List<CanDuplicateObject> CanDuplicateObjectCheckFunctions = new List<CanDuplicateObject>();
public void addCheckDuplicateObject(CanDuplicateObject delegateFunc)
{
if (!CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
CanDuplicateObjectCheckFunctions.Add(delegateFunc);
}
public void removeCheckDuplicateObject(CanDuplicateObject delegateFunc)
{
if (CanDuplicateObjectCheckFunctions.Contains(delegateFunc))
CanDuplicateObjectCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanDuplicateObject(int objectCount, LLUUID objectID, LLUUID owner, LLVector3 objectPosition)
{
foreach (CanDuplicateObject check in CanDuplicateObjectCheckFunctions)
{
if (check(objectCount, objectID, owner, m_scene, objectPosition) == false)
{
@ -219,6 +248,35 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region OBJECT ENTRY
public delegate bool CanObjectEntry(LLUUID objectID, LLVector3 newPoint, Scene scene);
private List<CanObjectEntry> CanObjectEntryCheckFunctions = new List<CanObjectEntry>();
public void addCheckObjectEntry(CanObjectEntry delegateFunc)
{
if (!CanObjectEntryCheckFunctions.Contains(delegateFunc))
CanObjectEntryCheckFunctions.Add(delegateFunc);
}
public void removeCheckObjectEntry(CanObjectEntry delegateFunc)
{
if (CanObjectEntryCheckFunctions.Contains(delegateFunc))
CanObjectEntryCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanObjectEntry(LLUUID objectID, LLVector3 newPoint)
{
foreach (CanObjectEntry check in CanObjectEntryCheckFunctions)
{
if (check(objectID, newPoint, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region RETURN OBJECT
public delegate bool CanReturnObject(LLUUID objectID, LLUUID returnerID, Scene scene);
private List<CanReturnObject> CanReturnObjectCheckFunctions = new List<CanReturnObject>();
@ -248,10 +306,6 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#endregion
#region Misc Permission Checks
#region INSTANT MESSAGE
public delegate bool CanInstantMessage(LLUUID user, LLUUID target, Scene startScene);
private List<CanInstantMessage> CanInstantMessageCheckFunctions = new List<CanInstantMessage>();
@ -310,6 +364,35 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region VIEW SCRIPT
public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene);
private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>();
public void addCheckViewScript(CanViewScript delegateFunc)
{
if (!CanViewScriptCheckFunctions.Contains(delegateFunc))
CanViewScriptCheckFunctions.Add(delegateFunc);
}
public void removeCheckViewScript(CanViewScript delegateFunc)
{
if (CanViewScriptCheckFunctions.Contains(delegateFunc))
CanViewScriptCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user)
{
foreach (CanViewScript check in CanViewScriptCheckFunctions)
{
if (check(script, user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region EDIT SCRIPT
public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene);
private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
@ -369,23 +452,23 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region TERRAFORM LAND
public delegate bool CanTerraformLandCommand(LLUUID user, LLVector3 position, Scene requestFromScene);
private List<CanTerraformLandCommand> CanTerraformLandCommandCheckFunctions = new List<CanTerraformLandCommand>();
public delegate bool CanTerraformLand(LLUUID user, LLVector3 position, Scene requestFromScene);
private List<CanTerraformLand> CanTerraformLandCheckFunctions = new List<CanTerraformLand>();
public void addCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc)
public void addCheckTerraformLand(CanTerraformLand delegateFunc)
{
if (!CanTerraformLandCommandCheckFunctions.Contains(delegateFunc))
CanTerraformLandCommandCheckFunctions.Add(delegateFunc);
if (!CanTerraformLandCheckFunctions.Contains(delegateFunc))
CanTerraformLandCheckFunctions.Add(delegateFunc);
}
public void removeCheckTerraformLandCommand(CanTerraformLandCommand delegateFunc)
public void removeCheckTerraformLand(CanTerraformLand delegateFunc)
{
if (CanTerraformLandCommandCheckFunctions.Contains(delegateFunc))
CanTerraformLandCommandCheckFunctions.Remove(delegateFunc);
if (CanTerraformLandCheckFunctions.Contains(delegateFunc))
CanTerraformLandCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanTerraformLand(LLUUID user, LLVector3 pos)
{
foreach (CanTerraformLandCommand check in CanTerraformLandCommandCheckFunctions)
foreach (CanTerraformLand check in CanTerraformLandCheckFunctions)
{
if (check(user, pos, m_scene) == false)
{
@ -426,6 +509,34 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region CAN ISSUE ESTATE COMMAND
public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene);
private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>();
public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
{
if (!CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
CanIssueEstateCommandCheckFunctions.Add(delegateFunc);
}
public void removeCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
{
if (CanIssueEstateCommandCheckFunctions.Contains(delegateFunc))
CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanIssueEstateCommand(LLUUID user)
{
foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions)
{
if (check(user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region CAN BE GODLIKE
public delegate bool CanBeGodLike(LLUUID user, Scene requestFromScene);
private List<CanBeGodLike> CanBeGodLikeCheckFunctions = new List<CanBeGodLike>();
@ -452,67 +563,6 @@ namespace OpenSim.Region.Environment.Scenes
}
return true;
}
#endregion
#endregion
#region Parcel and Estate Permission Checks
#region EDIT ESTATE TERRAIN
public delegate bool CanEditEstateTerrain(LLUUID user, Scene scene);
private List<CanEditEstateTerrain> CanEditEstateTerrainCheckFunctions = new List<CanEditEstateTerrain>();
public void addCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
{
if (!CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
CanEditEstateTerrainCheckFunctions.Add(delegateFunc);
}
public void removeCheckEditEstateTerrain(CanEditEstateTerrain delegateFunc)
{
if (CanEditEstateTerrainCheckFunctions.Contains(delegateFunc))
CanEditEstateTerrainCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanEditEstateTerrain(LLUUID user)
{
foreach (CanEditEstateTerrain check in CanEditEstateTerrainCheckFunctions)
{
if (check(user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region RESTART SIM
public delegate bool CanRestartSim(LLUUID user, Scene scene);
private List<CanRestartSim> CanRestartSimCheckFunctions = new List<CanRestartSim>();
public void addCheckRestartSim(CanRestartSim delegateFunc)
{
if (!CanRestartSimCheckFunctions.Contains(delegateFunc))
CanRestartSimCheckFunctions.Add(delegateFunc);
}
public void removeCheckRestartSim(CanRestartSim delegateFunc)
{
if (CanRestartSimCheckFunctions.Contains(delegateFunc))
CanRestartSimCheckFunctions.Remove(delegateFunc);
}
public bool ExternalChecksCanRestartSim(LLUUID user)
{
foreach (CanRestartSim check in CanRestartSimCheckFunctions)
{
if (check(user, m_scene) == false)
{
return false;
}
}
return true;
}
#endregion
#region EDIT PARCEL
@ -598,8 +648,10 @@ namespace OpenSim.Region.Environment.Scenes
return true;
}
#endregion
#endregion
}
}

View File

@ -145,7 +145,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelAbandonRequest OnParcelAbandonRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;

View File

@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public int osRegionRestart(double seconds)
{
m_host.AddScriptLPS(1);
if (World.ExternalChecks.ExternalChecksCanRestartSim(m_host.OwnerID))
if (World.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID))
{
World.Restart((float)seconds);
return 1;