Implement parcel group access control. This addresses mantis #158.

avinationmerge
meta7 2010-08-07 20:13:45 -07:00
parent aa54e8d95e
commit 0794c6a941
1 changed files with 1045 additions and 1013 deletions

View File

@ -281,6 +281,34 @@ namespace OpenSim.Region.CoreModules.World.Land
return false; return false;
} }
public bool HasGroupAccess(UUID avatar)
{
if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
{
IGroupsModule groupsModule =
m_scene.RequestModuleInterface<IGroupsModule>();
List<UUID> agentGroups = new List<UUID>();
if (groupsModule != null)
{
GroupMembershipData[] GroupMembership =
groupsModule.GetMembershipData(avatar);
if (GroupMembership != null)
{
for (int i = 0; i < GroupMembership.Length; i++)
{
if (LandData.GroupID == GroupMembership[i].GroupID)
{
return true;
}
}
}
}
}
return false;
}
public bool IsBannedFromLand(UUID avatar) public bool IsBannedFromLand(UUID avatar)
{ {
if (m_scene.Permissions.IsAdministrator(avatar)) if (m_scene.Permissions.IsAdministrator(avatar))
@ -316,11 +344,15 @@ namespace OpenSim.Region.CoreModules.World.Land
//If they are not on the access list and are not the owner //If they are not on the access list and are not the owner
if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
{
if (!HasGroupAccess(avatar))
{ {
//They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
return true; return true;
} }
} }
}
return false; return false;
} }