aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs58
1 files changed, 57 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index a0ed5a5..9808ebf 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -56,6 +56,12 @@ namespace OpenSim.Region.CoreModules.World.Land
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
58 58
59 protected IGroupsModule m_groupsModule;
60 protected const uint PARCEL_FLAG_USE_ACCESS_GROUP = 0x100; // parcel limits access to a group
61 protected Dictionary<UUID, long> m_isGroupMemberCache = new Dictionary<UUID, long>();
62 protected Dictionary<UUID, long> m_notGroupMemberCache = new Dictionary<UUID, long>();
63 protected const long m_groupMemberCacheTimeout = 30; // cache invalidation after 30 seconds
64
59 public bool[,] LandBitmap 65 public bool[,] LandBitmap
60 { 66 {
61 get { return m_landBitmap; } 67 get { return m_landBitmap; }
@@ -132,6 +138,8 @@ namespace OpenSim.Region.CoreModules.World.Land
132 else 138 else
133 LandData.GroupID = UUID.Zero; 139 LandData.GroupID = UUID.Zero;
134 LandData.IsGroupOwned = is_group_owned; 140 LandData.IsGroupOwned = is_group_owned;
141
142 m_groupsModule = scene.RequestModuleInterface<IGroupsModule>();
135 } 143 }
136 144
137 #endregion 145 #endregion
@@ -460,7 +468,55 @@ namespace OpenSim.Region.CoreModules.World.Land
460 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) 468 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
461 return false; 469 return false;
462 470
463 return (!IsInLandAccessList(avatar)); 471 if (IsInLandAccessList(avatar))
472 return false;
473
474 UUID groupID = LandData.GroupID;
475
476 if ((m_groupsModule != null) && (groupID != UUID.Zero) && ((LandData.Flags & PARCEL_FLAG_USE_ACCESS_GROUP) == PARCEL_FLAG_USE_ACCESS_GROUP))
477 {
478 long now = Util.UnixTimeSinceEpoch();
479
480 if (m_isGroupMemberCache.ContainsKey(avatar))
481 {
482 if (now - m_isGroupMemberCache[avatar] <= m_groupMemberCacheTimeout) // invalid?
483 {
484 m_isGroupMemberCache[avatar] = now;
485 return false;
486 }
487 else
488 m_isGroupMemberCache.Remove(avatar);
489 }
490
491 if (m_notGroupMemberCache.ContainsKey(avatar))
492 {
493 if (now - m_notGroupMemberCache[avatar] <= m_groupMemberCacheTimeout) // invalid?
494 {
495 // m_notGroupMemberCache[avatar] = now;
496 return true;
497 }
498 else
499 m_notGroupMemberCache.Remove(avatar);
500 }
501
502 GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(avatar);
503
504 if (GroupMembership != null)
505 {
506 for (int i = 0; i < GroupMembership.Length; i++)
507 {
508 if (groupID == GroupMembership[i].GroupID)
509 {
510 m_isGroupMemberCache[avatar] = now;
511 return false;
512 }
513 }
514 }
515
516 m_notGroupMemberCache[avatar] = now;
517 }
518
519 return true;
464 } 520 }
465 521
466 public bool IsInLandAccessList(UUID avatar) 522 public bool IsInLandAccessList(UUID avatar)