Add functionality to estate "Allowed Users" and "Allowed Groups". Allowed users

will be honored now, while allowed groups will not. This requires additional
groups module integration work
mysql-performance
Melanie 2010-01-09 14:17:44 +00:00
parent 18f12de52a
commit 063f106cbb
11 changed files with 209 additions and 120 deletions

View File

@ -1217,7 +1217,7 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow // Need to translate to MXP somehow
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
// Need to translate to MXP somehow // Need to translate to MXP somehow
} }

View File

@ -760,7 +760,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }

View File

@ -767,7 +767,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
throw new System.NotImplementedException(); throw new System.NotImplementedException();
} }

View File

@ -300,6 +300,34 @@ namespace OpenSim.Framework
OnSave(this); OnSave(this);
} }
public void AddEstateUser(UUID avatarID)
{
if (avatarID == UUID.Zero)
return;
if (!l_EstateAccess.Contains(avatarID))
l_EstateAccess.Add(avatarID);
}
public void RemoveEstateUser(UUID avatarID)
{
if (l_EstateAccess.Contains(avatarID))
l_EstateAccess.Remove(avatarID);
}
public void AddEstateGroup(UUID avatarID)
{
if (avatarID == UUID.Zero)
return;
if (!l_EstateGroups.Contains(avatarID))
l_EstateGroups.Add(avatarID);
}
public void RemoveEstateGroup(UUID avatarID)
{
if (l_EstateGroups.Contains(avatarID))
l_EstateGroups.Remove(avatarID);
}
public void AddEstateManager(UUID avatarID) public void AddEstateManager(UUID avatarID)
{ {
if (avatarID == UUID.Zero) if (avatarID == UUID.Zero)

View File

@ -1271,7 +1271,7 @@ namespace OpenSim.Framework
void SendHealth(float health); void SendHealth(float health);
void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID); void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID);
void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID); void SendBannedUserList(UUID invoice, EstateBan[] banlist, uint estateID);

View File

@ -3912,7 +3912,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false; return false;
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.AgentData.TransactionID = UUID.Random(); packet.AgentData.TransactionID = UUID.Random();
@ -3921,26 +3922,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.MethodData.Invoice = invoice; packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Utils.StringToBytes("setaccess"); packet.MethodData.Method = Utils.StringToBytes("setaccess");
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + EstateManagers.Length]; EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + Data.Length];
for (int i = 0; i < (6 + EstateManagers.Length); i++) for (int i = 0; i < (6 + Data.Length); i++)
{ {
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
} }
int j = 0; int j = 0;
returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateManagers).ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(code.ToString()); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes("0"); j++; returnblock[j].Parameter = Utils.StringToBytes("0"); j++;
returnblock[j].Parameter = Utils.StringToBytes(EstateManagers.Length.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(Data.Length.ToString()); j++;
for (int i = 0; i < EstateManagers.Length; i++) for (int i = 0; i < Data.Length; i++)
{ {
returnblock[j].Parameter = EstateManagers[i].GetBytes(); j++; returnblock[j].Parameter = Data[i].GetBytes(); j++;
} }
packet.ParamList = returnblock; packet.ParamList = returnblock;
packet.Header.Reliable = false; packet.Header.Reliable = true;
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }

View File

@ -75,10 +75,21 @@ namespace OpenSim.Region.CoreModules.World.Estate
m_scene.RegionInfo.EstateSettings.AbuseEmail, m_scene.RegionInfo.EstateSettings.AbuseEmail,
estateOwner); estateOwner);
remote_client.SendEstateManagersList(invoice, remote_client.SendEstateList(invoice,
(int)Constants.EstateAccessCodex.EstateManagers,
m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers,
m_scene.RegionInfo.EstateSettings.EstateID); m_scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendEstateList(invoice,
(int)Constants.EstateAccessCodex.AccessOptions,
m_scene.RegionInfo.EstateSettings.EstateAccess,
m_scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendEstateList(invoice,
(int)Constants.EstateAccessCodex.AllowedGroups,
m_scene.RegionInfo.EstateSettings.EstateGroups,
m_scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendBannedUserList(invoice, remote_client.SendBannedUserList(invoice,
m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateBans,
m_scene.RegionInfo.EstateSettings.EstateID); m_scene.RegionInfo.EstateSettings.EstateID);
@ -233,9 +244,63 @@ namespace OpenSim.Region.CoreModules.World.Estate
if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID) if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID)
return; // never process owner return; // never process owner
switch (estateAccessType) if ((estateAccessType & 4) != 0) // User add
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{
m_scene.RegionInfo.EstateSettings.AddEstateUser(user);
m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 8) != 0) // User remove
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{
m_scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 16) != 0) // Group add
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{
m_scene.RegionInfo.EstateSettings.AddEstateGroup(user);
m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 32) != 0) // Group remove
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{
m_scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, m_scene.RegionInfo.EstateSettings.EstateAccess, m_scene.RegionInfo.EstateSettings.EstateID);
}
else
{
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
}
}
if ((estateAccessType & 64) != 0) // Ban add
{ {
case 64:
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
{ {
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
@ -286,8 +351,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
} }
break; }
case 128: if ((estateAccessType & 128) != 0) // Ban remove
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions()) if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || m_scene.Permissions.BypassPermissions())
{ {
EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans; EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
@ -321,39 +387,33 @@ namespace OpenSim.Region.CoreModules.World.Estate
{ {
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
} }
break; }
case 256: if ((estateAccessType & 256) != 0) // Manager add
{
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save(); m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
} }
}
break; if ((estateAccessType & 512) != 0) // Manager remove
case 512: {
if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions()) if (m_scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || m_scene.Permissions.BypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
m_scene.RegionInfo.EstateSettings.Save(); m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID); remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
} }
break;
default:
m_log.ErrorFormat("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta: {0}", estateAccessType.ToString());
break;
} }
} }

View File

@ -879,7 +879,7 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }

View File

@ -1220,7 +1220,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }

View File

@ -897,7 +897,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }

View File

@ -924,7 +924,7 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public void SendEstateManagersList(UUID invoice, UUID[] EstateManagers, uint estateID) public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{ {
} }