Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

0.7.4.1
Diva Canto 2012-04-06 11:52:38 -07:00
commit 4c32f79c10
2 changed files with 49 additions and 3 deletions

View File

@ -56,6 +56,9 @@ namespace OpenSim.Region.CoreModules.World.Land
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
public bool[,] LandBitmap public bool[,] LandBitmap
{ {
get { return m_landBitmap; } get { return m_landBitmap; }
@ -417,6 +420,45 @@ namespace OpenSim.Region.CoreModules.World.Land
return false; return false;
} }
public bool HasGroupAccess(UUID avatar)
{
if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
{
ScenePresence sp;
if (!m_scene.TryGetScenePresence(avatar, out sp))
{
bool isMember;
if (m_groupMemberCache.TryGetValue(avatar, out isMember))
return isMember;
IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
if (groupsModule == null)
return false;
GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar);
if (membership == null || membership.Length == 0)
{
m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
return false;
}
foreach (GroupMembershipData d in membership)
{
if (d.GroupID == LandData.GroupID)
{
m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout);
return true;
}
}
m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout);
return false;
}
return sp.ControllingClient.IsGroupMember(LandData.GroupID);
}
return false;
}
public bool IsBannedFromLand(UUID avatar) public bool IsBannedFromLand(UUID avatar)
{ {
ExpireAccessList(); ExpireAccessList();
@ -448,6 +490,9 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsRestrictedFromLand(UUID avatar) public bool IsRestrictedFromLand(UUID avatar)
{ {
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
return false;
if (m_scene.Permissions.IsAdministrator(avatar)) if (m_scene.Permissions.IsAdministrator(avatar))
return false; return false;
@ -457,10 +502,10 @@ namespace OpenSim.Region.CoreModules.World.Land
if (avatar == LandData.OwnerID) if (avatar == LandData.OwnerID)
return false; return false;
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) if (HasGroupAccess(avatar))
return false; return false;
return (!IsInLandAccessList(avatar)); return !IsInLandAccessList(avatar);
} }
public bool IsInLandAccessList(UUID avatar) public bool IsInLandAccessList(UUID avatar)

View File

@ -1294,7 +1294,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero);
// Need to send a group membership update to the client // Need to send a group membership update to the client
// UDP version doesn't seem to behave nicely. But we're going to send it out here // UDP version doesn't seem to behave nicely. But we're going to send it out here
// with an empty group membership to hopefully remove groups being displayed due // with an empty group membership to hopefully remove groups being displayed due
@ -1305,6 +1304,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray);
remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray);
if (remoteClient.AgentId == dataForAgentID)
remoteClient.RefreshGroupMembership();
} }
/// <summary> /// <summary>