diff options
author | Justin Clark-Casey (justincc) | 2009-11-05 18:53:57 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-11-05 18:53:57 +0000 |
commit | bae03dfcbd9ad8aa2c6a0366f0e387a358317a9d (patch) | |
tree | 231e38c0e74afae0032a200b662be13383c63e13 /OpenSim | |
parent | * Escape / character when saving items and folders in an iar so that the load... (diff) | |
parent | Change the permissions module to use the friend list cache already in the (diff) | |
download | opensim-SC_OLD-bae03dfcbd9ad8aa2c6a0366f0e387a358317a9d.zip opensim-SC_OLD-bae03dfcbd9ad8aa2c6a0366f0e387a358317a9d.tar.gz opensim-SC_OLD-bae03dfcbd9ad8aa2c6a0366f0e387a358317a9d.tar.bz2 opensim-SC_OLD-bae03dfcbd9ad8aa2c6a0366f0e387a358317a9d.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
3 files changed, 31 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index c6fd72e..bb4e032 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -1114,6 +1114,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
1114 | { | 1114 | { |
1115 | ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights); | 1115 | ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights); |
1116 | } | 1116 | } |
1117 | |||
1118 | public List<FriendListItem> GetUserFriends(UUID agentID) | ||
1119 | { | ||
1120 | List<FriendListItem> fl; | ||
1121 | lock (m_friendLists) | ||
1122 | { | ||
1123 | fl = (List<FriendListItem>)m_friendLists.Get(agentID.ToString(), | ||
1124 | m_initialScene.GetFriendList); | ||
1125 | } | ||
1126 | |||
1127 | return fl; | ||
1128 | } | ||
1117 | } | 1129 | } |
1118 | #endregion | 1130 | #endregion |
1119 | } | 1131 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index effe1f0..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,31 +487,18 @@ 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 | m_log.Warn("IsFriendWithPerms called" + item.FriendPerms.ToString()); | 500 | if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0) |
488 | if(item.Friend == objectOwner) | 501 | return true; |
489 | { | ||
490 | // if (item.FriendPerms == 3) | ||
491 | // { | ||
492 | // return true; | ||
493 | // } | ||
494 | // if (item.FriendPerms == 4) | ||
495 | // { | ||
496 | // return true; | ||
497 | // } | ||
498 | // if (item.FriendPerms == 5) | ||
499 | // { | ||
500 | // return true; | ||
501 | // } | ||
502 | // if (item.FriendPerms == 7) | ||
503 | // { | ||
504 | // return true; | ||
505 | // } | ||
506 | } | ||
507 | } | 502 | } |
508 | return false; | 503 | return false; |
509 | } | 504 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs index 7a8aba2..8386030 100644 --- a/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IFriendsModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using OpenMetaverse; | 28 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using System.Collections.Generic; | ||
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 33 | { |
@@ -45,5 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
45 | /// </param> | 46 | /// </param> |
46 | /// <param name="offerMessage"></param> | 47 | /// <param name="offerMessage"></param> |
47 | void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); | 48 | void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); |
49 | List<FriendListItem> GetUserFriends(UUID agentID); | ||
48 | } | 50 | } |
49 | } | 51 | } |