diff options
author | Melanie | 2012-04-04 23:57:50 +0100 |
---|---|---|
committer | Melanie | 2012-04-04 23:57:50 +0100 |
commit | 3a0aac97b4a3094e18ddae9a35ef29690344b58f (patch) | |
tree | 22585eeaee6d8b00e5decef6d6fbd9f4db9187e2 /OpenSim/Region/CoreModules | |
parent | Fix the last merge artefacts (diff) | |
parent | Implements group based access restrictions for parcels of land. Because of ca... (diff) | |
download | opensim-SC-3a0aac97b4a3094e18ddae9a35ef29690344b58f.zip opensim-SC-3a0aac97b4a3094e18ddae9a35ef29690344b58f.tar.gz opensim-SC-3a0aac97b4a3094e18ddae9a35ef29690344b58f.tar.bz2 opensim-SC-3a0aac97b4a3094e18ddae9a35ef29690344b58f.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 58 |
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 e86887d..c21cf31 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 |
@@ -512,7 +520,55 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
512 | if (HasGroupAccess(avatar)) | 520 | if (HasGroupAccess(avatar)) |
513 | return false; | 521 | return false; |
514 | 522 | ||
515 | return (!IsInLandAccessList(avatar)); | 523 | if (IsInLandAccessList(avatar)) |
524 | return false; | ||
525 | |||
526 | UUID groupID = LandData.GroupID; | ||
527 | |||
528 | if ((m_groupsModule != null) && (groupID != UUID.Zero) && ((LandData.Flags & PARCEL_FLAG_USE_ACCESS_GROUP) == PARCEL_FLAG_USE_ACCESS_GROUP)) | ||
529 | { | ||
530 | long now = Util.UnixTimeSinceEpoch(); | ||
531 | |||
532 | if (m_isGroupMemberCache.ContainsKey(avatar)) | ||
533 | { | ||
534 | if (now - m_isGroupMemberCache[avatar] <= m_groupMemberCacheTimeout) // invalid? | ||
535 | { | ||
536 | m_isGroupMemberCache[avatar] = now; | ||
537 | return false; | ||
538 | } | ||
539 | else | ||
540 | m_isGroupMemberCache.Remove(avatar); | ||
541 | } | ||
542 | |||
543 | if (m_notGroupMemberCache.ContainsKey(avatar)) | ||
544 | { | ||
545 | if (now - m_notGroupMemberCache[avatar] <= m_groupMemberCacheTimeout) // invalid? | ||
546 | { | ||
547 | // m_notGroupMemberCache[avatar] = now; | ||
548 | return true; | ||
549 | } | ||
550 | else | ||
551 | m_notGroupMemberCache.Remove(avatar); | ||
552 | } | ||
553 | |||
554 | GroupMembershipData[] GroupMembership = m_groupsModule.GetMembershipData(avatar); | ||
555 | |||
556 | if (GroupMembership != null) | ||
557 | { | ||
558 | for (int i = 0; i < GroupMembership.Length; i++) | ||
559 | { | ||
560 | if (groupID == GroupMembership[i].GroupID) | ||
561 | { | ||
562 | m_isGroupMemberCache[avatar] = now; | ||
563 | return false; | ||
564 | } | ||
565 | } | ||
566 | } | ||
567 | |||
568 | m_notGroupMemberCache[avatar] = now; | ||
569 | } | ||
570 | |||
571 | return true; | ||
516 | } | 572 | } |
517 | 573 | ||
518 | public bool IsInLandAccessList(UUID avatar) | 574 | public bool IsInLandAccessList(UUID avatar) |