Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

0.6.8-post-fixes
Justin Clark-Casey (justincc) 2009-11-05 18:53:57 +00:00
commit bae03dfcbd
3 changed files with 31 additions and 22 deletions

View File

@ -1114,6 +1114,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{ {
((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights); ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
} }
public List<FriendListItem> GetUserFriends(UUID agentID)
{
List<FriendListItem> fl;
lock (m_friendLists)
{
fl = (List<FriendListItem>)m_friendLists.Get(agentID.ToString(),
m_initialScene.GetFriendList);
}
return fl;
}
} }
#endregion #endregion
} }

View File

@ -144,6 +144,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
private IFriendsModule m_friendsModule = null;
#endregion #endregion
#region IRegionModule Members #region IRegionModule Members
@ -363,6 +365,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
public void PostInitialise() public void PostInitialise()
{ {
m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (m_friendsModule == null)
m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
else
m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
} }
public void Close() public void Close()
@ -479,31 +487,18 @@ namespace OpenSim.Region.CoreModules.World.Permissions
protected bool IsFriendWithPerms(UUID user,UUID objectOwner) protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
{ {
if (user == UUID.Zero) return false; if (user == UUID.Zero)
return false;
if (m_friendsModule == null)
return false;
List<FriendListItem> profile = m_friendsModule.GetUserFriends(user);
List<FriendListItem> profile = m_scene.CommsManager.GetUserFriendList(user);
foreach (FriendListItem item in profile) foreach (FriendListItem item in profile)
{ {
m_log.Warn("IsFriendWithPerms called" + item.FriendPerms.ToString()); if(item.Friend == objectOwner && (item.FriendPerms & (uint)FriendRights.CanModifyObjects) != 0)
if(item.Friend == objectOwner) return true;
{
// if (item.FriendPerms == 3)
// {
// return true;
// }
// if (item.FriendPerms == 4)
// {
// return true;
// }
// if (item.FriendPerms == 5)
// {
// return true;
// }
// if (item.FriendPerms == 7)
// {
// return true;
// }
}
} }
return false; return false;
} }

View File

@ -27,6 +27,7 @@
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using System.Collections.Generic;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
@ -45,5 +46,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// </param> /// </param>
/// <param name="offerMessage"></param> /// <param name="offerMessage"></param>
void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage); void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
List<FriendListItem> GetUserFriends(UUID agentID);
} }
} }