Make the estate owner work. Changes permissions checks to allow the

estate owner user the ability to add and remove estate managers,
and have EM rights outside of that.
0.6.0-stable
Melanie Thielker 2008-08-14 18:08:22 +00:00
parent 35aeb9010a
commit c2f1771c63
7 changed files with 42 additions and 30 deletions

View File

@ -312,9 +312,20 @@ namespace OpenSim.Framework
public bool IsEstateManager(LLUUID avatarID) public bool IsEstateManager(LLUUID avatarID)
{ {
if (IsEstateOwner(avatarID))
return true;
return l_EstateManagers.Contains(avatarID); return l_EstateManagers.Contains(avatarID);
} }
public bool IsEstateOwner(LLUUID avatarID)
{
if (avatarID == m_EstateOwner)
return true;
return false;
}
public bool IsBanned(LLUUID avatarID) public bool IsBanned(LLUUID avatarID)
{ {
foreach (EstateBan ban in l_EstateBans) foreach (EstateBan ban in l_EstateBans)

View File

@ -5465,14 +5465,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
switch (Helpers.FieldToUTF8String(messagePacket.MethodData.Method)) switch (Helpers.FieldToUTF8String(messagePacket.MethodData.Method))
{ {
case "getinfo": case "getinfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{ {
OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice); OnDetailedEstateDataRequest(this, messagePacket.MethodData.Invoice);
} }
break; break;
case "setregioninfo": case "setregioninfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter), OnSetEstateFlagsRequest(convertParamStringToBool(messagePacket.ParamList[0].Parameter), convertParamStringToBool(messagePacket.ParamList[1].Parameter),
convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter), convertParamStringToBool(messagePacket.ParamList[2].Parameter), !convertParamStringToBool(messagePacket.ParamList[3].Parameter),
@ -5485,7 +5484,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
// case "texturebase": // case "texturebase":
// if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) // if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
// { // {
// foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) // foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
// { // {
@ -5500,7 +5499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// } // }
// break; // break;
case "texturedetail": case "texturedetail":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{ {
@ -5518,7 +5517,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
case "textureheights": case "textureheights":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{ {
@ -5539,7 +5538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OnCommitEstateTerrainTextureRequest(this); OnCommitEstateTerrainTextureRequest(this);
break; break;
case "setregionterrain": case "setregionterrain":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
if (messagePacket.ParamList.Length != 9) if (messagePacket.ParamList.Length != 9)
{ {
@ -5578,7 +5577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
case "restart": case "restart":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
// There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
@ -5592,7 +5591,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "estatechangecovenantid": case "estatechangecovenantid":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList) foreach (EstateOwnerMessagePacket.ParamListBlock block in messagePacket.ParamList)
{ {
@ -5602,7 +5601,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "estateaccessdelta": // Estate access delta manages the banlist and allow list too. case "estateaccessdelta": // Estate access delta manages the banlist and allow list too.
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter)); int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter))); OnUpdateEstateAccessDeltaRequest(this, messagePacket.MethodData.Invoice, estateAccessType, new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)));
@ -5610,7 +5609,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "simulatormessage": case "simulatormessage":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter)); LLUUID SenderID = new LLUUID(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
@ -5621,7 +5620,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "instantmessage": case "instantmessage":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
if (messagePacket.ParamList.Length < 5) if (messagePacket.ParamList.Length < 5)
break; break;
@ -5634,7 +5633,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "setregiondebug": case "setregiondebug":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID; LLUUID SenderID = messagePacket.AgentData.AgentID;
@ -5646,7 +5645,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "teleporthomeuser": case "teleporthomeuser":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID; LLUUID SenderID = messagePacket.AgentData.AgentID;
@ -5672,7 +5671,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "terrain": case "terrain":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
handlerBakeTerrain = OnBakeTerrain; handlerBakeTerrain = OnBakeTerrain;
if (handlerBakeTerrain != null) if (handlerBakeTerrain != null)
@ -5683,7 +5682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
case "estatechangeinfo": case "estatechangeinfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId)) if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId, false))
{ {
LLUUID invoice = messagePacket.MethodData.Invoice; LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID; LLUUID SenderID = messagePacket.AgentData.AgentID;

View File

@ -218,7 +218,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
switch (estateAccessType) switch (estateAccessType)
{ {
case 64: case 64:
if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, false) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
@ -267,7 +267,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
} }
break; break;
case 128: case 128:
if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, false) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
@ -303,9 +303,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
break; break;
case 256: case 256:
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, true) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
// 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.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save(); m_scene.RegionInfo.EstateSettings.Save();
@ -318,9 +316,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
break; break;
case 512: case 512:
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId, true) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
// 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.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save(); m_scene.RegionInfo.EstateSettings.Save();

View File

@ -626,11 +626,17 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
return GenericCommunicationPermission(user, target); return GenericCommunicationPermission(user, target);
} }
private bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene) private bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene, bool ownerCommand)
{ {
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue; if (m_bypassPermissions) return m_bypassPermissionsValue;
if (m_scene.RegionInfo.EstateSettings.IsEstateOwner(user))
return true;
if (ownerCommand)
return false;
return GenericEstatePermission(user); return GenericEstatePermission(user);
} }

View File

@ -761,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
#endregion #endregion
#region CAN ISSUE ESTATE COMMAND #region CAN ISSUE ESTATE COMMAND
public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene); public delegate bool CanIssueEstateCommand(LLUUID user, Scene requestFromScene, bool ownerCommand);
private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>(); private List<CanIssueEstateCommand> CanIssueEstateCommandCheckFunctions = new List<CanIssueEstateCommand>();
public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc) public void addCheckIssueEstateCommand(CanIssueEstateCommand delegateFunc)
@ -775,11 +775,11 @@ namespace OpenSim.Region.Environment.Scenes
CanIssueEstateCommandCheckFunctions.Remove(delegateFunc); CanIssueEstateCommandCheckFunctions.Remove(delegateFunc);
} }
public bool ExternalChecksCanIssueEstateCommand(LLUUID user) public bool ExternalChecksCanIssueEstateCommand(LLUUID user, bool ownerCommand)
{ {
foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions) foreach (CanIssueEstateCommand check in CanIssueEstateCommandCheckFunctions)
{ {
if (check(user, m_scene) == false) if (check(user, m_scene, ownerCommand) == false)
{ {
return false; return false;
} }

View File

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

View File

@ -121,7 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (World.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID)) if (World.ExternalChecks.ExternalChecksCanIssueEstateCommand(m_host.OwnerID, false))
{ {
World.Restart((float)seconds); World.Restart((float)seconds);
return 1; return 1;