diff options
author | Diva Canto | 2012-04-06 11:52:38 -0700 |
---|---|---|
committer | Diva Canto | 2012-04-06 11:52:38 -0700 |
commit | 4c32f79c10bf38985fc9f4154aa14be4f604b93c (patch) | |
tree | 35f22541723717f19345dbcb308860d6a816a154 | |
parent | If an AddItem fails, try adding it to the right folder type. (diff) | |
parent | Added missing refresh of group membership client side cache to the groups mod... (diff) | |
download | opensim-SC-4c32f79c10bf38985fc9f4154aa14be4f604b93c.zip opensim-SC-4c32f79c10bf38985fc9f4154aa14be4f604b93c.tar.gz opensim-SC-4c32f79c10bf38985fc9f4154aa14be4f604b93c.tar.bz2 opensim-SC-4c32f79c10bf38985fc9f4154aa14be4f604b93c.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 3 |
2 files changed, 49 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index a0ed5a5..ced7b52 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -56,6 +56,9 @@ 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 ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | ||
60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | ||
61 | |||
59 | public bool[,] LandBitmap | 62 | public bool[,] LandBitmap |
60 | { | 63 | { |
61 | get { return m_landBitmap; } | 64 | get { return m_landBitmap; } |
@@ -417,6 +420,45 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
417 | return false; | 420 | return false; |
418 | } | 421 | } |
419 | 422 | ||
423 | public bool HasGroupAccess(UUID avatar) | ||
424 | { | ||
425 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
426 | { | ||
427 | ScenePresence sp; | ||
428 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
429 | { | ||
430 | bool isMember; | ||
431 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) | ||
432 | return isMember; | ||
433 | |||
434 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
435 | if (groupsModule == null) | ||
436 | return false; | ||
437 | |||
438 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
439 | if (membership == null || membership.Length == 0) | ||
440 | { | ||
441 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
442 | return false; | ||
443 | } | ||
444 | |||
445 | foreach (GroupMembershipData d in membership) | ||
446 | { | ||
447 | if (d.GroupID == LandData.GroupID) | ||
448 | { | ||
449 | m_groupMemberCache.Add(avatar, true, m_groupMemberCacheTimeout); | ||
450 | return true; | ||
451 | } | ||
452 | } | ||
453 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
454 | return false; | ||
455 | } | ||
456 | |||
457 | return sp.ControllingClient.IsGroupMember(LandData.GroupID); | ||
458 | } | ||
459 | return false; | ||
460 | } | ||
461 | |||
420 | public bool IsBannedFromLand(UUID avatar) | 462 | public bool IsBannedFromLand(UUID avatar) |
421 | { | 463 | { |
422 | ExpireAccessList(); | 464 | ExpireAccessList(); |
@@ -448,6 +490,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
448 | 490 | ||
449 | public bool IsRestrictedFromLand(UUID avatar) | 491 | public bool IsRestrictedFromLand(UUID avatar) |
450 | { | 492 | { |
493 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) | ||
494 | return false; | ||
495 | |||
451 | if (m_scene.Permissions.IsAdministrator(avatar)) | 496 | if (m_scene.Permissions.IsAdministrator(avatar)) |
452 | return false; | 497 | return false; |
453 | 498 | ||
@@ -457,10 +502,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
457 | if (avatar == LandData.OwnerID) | 502 | if (avatar == LandData.OwnerID) |
458 | return false; | 503 | return false; |
459 | 504 | ||
460 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) | 505 | if (HasGroupAccess(avatar)) |
461 | return false; | 506 | return false; |
462 | 507 | ||
463 | return (!IsInLandAccessList(avatar)); | 508 | return !IsInLandAccessList(avatar); |
464 | } | 509 | } |
465 | 510 | ||
466 | public bool IsInLandAccessList(UUID avatar) | 511 | public bool IsInLandAccessList(UUID avatar) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 2a15e5d..e669f4c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -1294,7 +1294,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1294 | 1294 | ||
1295 | OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); | 1295 | OnAgentDataUpdateRequest(remoteClient, dataForAgentID, UUID.Zero); |
1296 | 1296 | ||
1297 | |||
1298 | // Need to send a group membership update to the client | 1297 | // Need to send a group membership update to the client |
1299 | // UDP version doesn't seem to behave nicely. But we're going to send it out here | 1298 | // UDP version doesn't seem to behave nicely. But we're going to send it out here |
1300 | // with an empty group membership to hopefully remove groups being displayed due | 1299 | // with an empty group membership to hopefully remove groups being displayed due |
@@ -1305,6 +1304,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1305 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); | 1304 | SendGroupMembershipInfoViaCaps(remoteClient, dataForAgentID, membershipArray); |
1306 | remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); | 1305 | remoteClient.SendAvatarGroupsReply(dataForAgentID, membershipArray); |
1307 | 1306 | ||
1307 | if (remoteClient.AgentId == dataForAgentID) | ||
1308 | remoteClient.RefreshGroupMembership(); | ||
1308 | } | 1309 | } |
1309 | 1310 | ||
1310 | /// <summary> | 1311 | /// <summary> |