diff options
Change the permissions module to use the friend list cache already in the
friends module instead of requesting the entire friends list over the
network each time a prim is touched.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f7675f4..c790624 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -144,6 +144,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
144 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 144 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
145 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 145 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
146 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 146 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
147 | private IFriendsModule m_friendsModule = null; | ||
148 | |||
147 | #endregion | 149 | #endregion |
148 | 150 | ||
149 | #region IRegionModule Members | 151 | #region IRegionModule Members |
@@ -363,6 +365,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
363 | 365 | ||
364 | public void PostInitialise() | 366 | public void PostInitialise() |
365 | { | 367 | { |
368 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
369 | |||
370 | if (m_friendsModule == null) | ||
371 | m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | ||
372 | else | ||
373 | m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); | ||
366 | } | 374 | } |
367 | 375 | ||
368 | public void Close() | 376 | public void Close() |
@@ -479,9 +487,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
479 | protected bool IsFriendWithPerms(UUID user,UUID objectOwner) | 487 | protected bool IsFriendWithPerms(UUID user,UUID objectOwner) |
480 | { | 488 | { |
481 | 489 | ||
482 | if (user == UUID.Zero) return false; | 490 | if (user == UUID.Zero) |
491 | return false; | ||
492 | |||
493 | if (m_friendsModule == null) | ||
494 | return false; | ||
495 | |||
496 | List<FriendListItem> profile = m_friendsModule.GetUserFriends(user); | ||
483 | 497 | ||
484 | List<FriendListItem> profile = m_scene.CommsManager.GetUserFriendList(user); | ||
485 | foreach (FriendListItem item in profile) | 498 | foreach (FriendListItem item in profile) |
486 | { | 499 | { |
487 | if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0) | 500 | if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0) |