* Added the ability for Region Owners to add and remove estate managers using the estate tools.

* Estate managers get abilities like the region owner for now.
* Estate managers, you'll need to request server admin status to be able to activate the estate tools dialog (haven't figured out why this is the case yet)
* Switching from grid mode to standalone or switching grids will make the stored Estate Manager UUIDs not match up with a valid account so you'll see (waiting) listed there instead of a user until you reset them or go back to the grid you added them from.
afrisby
Teravus Ovares 2008-01-02 20:25:47 +00:00
parent d893c91249
commit a72d33d3a5
3 changed files with 142 additions and 29 deletions

View File

@ -647,7 +647,7 @@ namespace OpenSim.Framework
{
pos = GetNextEstateManager(pos);
rEstateManagers[i] = GetEstateManagerAtPos(pos);
rEstateManagers[i] = GetEstateManagerAtPos(pos); pos++;
}
return rEstateManagers;
@ -683,6 +683,61 @@ namespace OpenSim.Framework
return numEstateManagers;
}
public void AddEstateManager(LLUUID avatarID)
{
LLUUID[] testateManagers = GetEstateManagers();
LLUUID[] nestateManagers = new LLUUID[testateManagers.Length + 1];
int i = 0;
for (i = 0; i < testateManagers.Length; i++)
{
nestateManagers[i] = testateManagers[i];
}
nestateManagers[i] = avatarID;
//Saves it to the estate settings file
estateManagers = nestateManagers;
}
public void RemoveEstateManager(LLUUID avatarID)
{
int notfoundparam = 11; // starting high so the condense routine (max ten) doesn't run if we don't find it.
LLUUID[] testateManagers = GetEstateManagers(); // temporary estate managers list
int i = 0;
int foundpos = notfoundparam;
// search for estate manager.
for (i = 0; i < testateManagers.Length; i++)
{
if (testateManagers[i] == avatarID)
{
foundpos = i;
break;
}
}
if (foundpos < notfoundparam)
{
LLUUID[] restateManagers = new LLUUID[testateManagers.Length - 1];
// fill new estate managers array up to the found spot
for (int j = 0; j < foundpos; j++)
restateManagers[j] = testateManagers[j];
// skip over the estate manager we're removing and compress
for (int j = foundpos + 1; j < testateManagers.Length; j++)
restateManagers[j - 1] = testateManagers[j];
estateManagers = restateManagers;
}
else
{
OpenSim.Framework.Console.MainLog.Instance.Error("ESTATESETTINGS", "Unable to locate estate manager : " + avatarID.ToString() + " for removal");
}
}
#endregion
private ConfigurationMember configMember;

View File

@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment
{
case "getinfo":
//MainLog.Instance.Verbose("ESTATE","CLIENT--->" + packet.ToString());
sendRegionInfoPacketToAll();
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
@ -198,6 +198,12 @@ namespace OpenSim.Region.Environment
EstateChangeCovenant(packet);
}
break;
case "estateaccessdelta":
if (m_scene.PermissionsMngr.GenericEstatePermission(remote_client.AgentId))
{
estateAccessDelta(remote_client, packet);
}
break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
break;
@ -220,17 +226,28 @@ namespace OpenSim.Region.Environment
//Sending Estate Settings
returnblock[0].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarFirstName + m_scene.RegionInfo.MasterAvatarLastName);
returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
returnblock[2].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID);
returnblock[3].Parameter = Helpers.IntToBytes(269516800);
returnblock[4].Parameter = Helpers.IntToBytes(0);
returnblock[5].Parameter = Helpers.IntToBytes(1);
returnblock[6].Parameter = Helpers.StringToField(LLUUID.Random().ToString());
returnblock[7].Parameter = Helpers.IntToBytes(1160895077);
returnblock[8].Parameter = Helpers.IntToBytes(1);
returnblock[2].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString());
// TODO: Resolve Magic numbers here
returnblock[3].Parameter = Helpers.StringToField("269516800");
returnblock[4].Parameter = Helpers.StringToField("0");
returnblock[5].Parameter = Helpers.StringToField("1");
returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString());
returnblock[7].Parameter = Helpers.StringToField("1160895077");
returnblock[8].Parameter = Helpers.StringToField("1");
packet.ParamList = returnblock;
//MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
// Stuck here at the moment The client sends a bunch of getinfo methods that need to be decoded the hard way
sendEstateManagerList(remote_client, packet);
}
private void sendEstateManagerList(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
LLUUID invoice = packet.MethodData.Invoice;
//Sending Estate Managers
packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = LLUUID.Random();
@ -241,32 +258,73 @@ namespace OpenSim.Region.Environment
LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers;
returnblock = new EstateOwnerMessagePacket.ParamListBlock[6+EstateManagers.Length];
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length];
for (int i = 0; i < (6 + EstateManagers.Length); i++)
{
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
}
int j = 0;
returnblock[j].Parameter = Helpers.IntToBytes((int)m_scene.RegionInfo.EstateSettings.estateID); j++;
returnblock[j].Parameter = Helpers.IntToBytes((int)EstateAccessCodex.EstateManagers); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(0); j++;
returnblock[j].Parameter = Helpers.IntToBytes(EstateManagers.Length); j++;
returnblock[j].Parameter = Helpers.StringToField(m_scene.RegionInfo.EstateSettings.estateID.ToString()); j++;
returnblock[j].Parameter = Helpers.StringToField(((int)EstateAccessCodex.EstateManagers).ToString()); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++;
returnblock[j].Parameter = Helpers.StringToField(EstateManagers.Length.ToString()); j++;
for (int i = 0; i < EstateManagers.Length; i++)
{
returnblock[j].Parameter = Helpers.StringToField(EstateManagers[i].ToString()); j++;
returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++;
}
packet.ParamList = returnblock;
//MainLog.Instance.Verbose("ESTATE", "SIM--->" + packet.ToString());
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
}
private void estateAccessDelta(IClientAPI remote_client, EstateOwnerMessagePacket packet)
{
// EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
int estateAccessType = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
switch (estateAccessType)
{
case 256:
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
// So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
{
m_scene.RegionInfo.EstateSettings.AddEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)));
sendEstateManagerList(remote_client, packet);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
break;
case 512:
// This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
// So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
if (packet.AgentData.AgentID == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
{
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(new LLUUID(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)));
sendEstateManagerList(remote_client, packet);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
break;
default:
MainLog.Instance.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta\n" + packet.ToString());
break;
}
//MainLog.Instance.Error("EstateOwnerMessage: estateAccessDelta\n" + packet.ToString());
}
private void estateSetRegionInfoHandler(EstateOwnerMessagePacket packet)
{
if (packet.ParamList.Length != 9)

View File

@ -1790,7 +1790,7 @@ namespace OpenSim.Region.Environment.Scenes
IClientAPI controllingClient)
{
// First check that this is the sim owner
if (agentID == RegionInfo.MasterAvatarAssignedUUID)
if (m_permissionManager.GenericEstatePermission(agentID))
{
// User needs to be logged into this sim
if (m_scenePresences.ContainsKey(agentID))
@ -1826,7 +1826,7 @@ namespace OpenSim.Region.Environment.Scenes
LLUUID kickUserID = new LLUUID("44e87126e7944ded05b37c42da3d5cdb");
if (m_scenePresences.ContainsKey(agentID) || agentID == kickUserID)
{
if (godID == RegionInfo.MasterAvatarAssignedUUID)
if (m_permissionManager.GenericEstatePermission(godID))
{
if (agentID == kickUserID)
{