Patch by revolution, thank you. Mantis #1789 . Implement friends permissions.
Applied with major changes. Core functionality commented pending review for possible rights escalation. No user functionality yet.0.6.8-post-fixes
parent
30a2411e58
commit
83b4b4440b
|
@ -676,6 +676,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
public event MoneyTransferRequest OnMoneyTransferRequest;
|
public event MoneyTransferRequest OnMoneyTransferRequest;
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
|
|
@ -327,6 +327,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||||
public event FriendActionDelegate OnApproveFriendRequest = delegate { };
|
public event FriendActionDelegate OnApproveFriendRequest = delegate { };
|
||||||
public event FriendActionDelegate OnDenyFriendRequest = delegate { };
|
public event FriendActionDelegate OnDenyFriendRequest = delegate { };
|
||||||
public event FriendshipTermination OnTerminateFriendship = delegate { };
|
public event FriendshipTermination OnTerminateFriendship = delegate { };
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights = delegate { };
|
||||||
public event MoneyTransferRequest OnMoneyTransferRequest = delegate { };
|
public event MoneyTransferRequest OnMoneyTransferRequest = delegate { };
|
||||||
public event EconomyDataRequest OnEconomyDataRequest = delegate { };
|
public event EconomyDataRequest OnEconomyDataRequest = delegate { };
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest = delegate { };
|
public event MoneyBalanceRequest OnMoneyBalanceRequest = delegate { };
|
||||||
|
@ -406,6 +407,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||||
public event PlacesQuery OnPlacesQuery = delegate { };
|
public event PlacesQuery OnPlacesQuery = delegate { };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void SetDebugPacketLevel(int newDebug)
|
public void SetDebugPacketLevel(int newDebug)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
|
|
|
@ -446,6 +446,7 @@ namespace OpenSim.Framework
|
||||||
public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes);
|
public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes);
|
||||||
public delegate void MuteListRequest(IClientAPI client, uint muteCRC);
|
public delegate void MuteListRequest(IClientAPI client, uint muteCRC);
|
||||||
public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
|
public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
|
||||||
|
public delegate void GrantUserFriendRights(IClientAPI client, UUID requester, UUID target, int rights);
|
||||||
public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
|
public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
|
||||||
|
|
||||||
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
|
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
|
||||||
|
@ -1023,6 +1024,7 @@ namespace OpenSim.Framework
|
||||||
event PickInfoUpdate OnPickInfoUpdate;
|
event PickInfoUpdate OnPickInfoUpdate;
|
||||||
event AvatarNotesUpdate OnAvatarNotesUpdate;
|
event AvatarNotesUpdate OnAvatarNotesUpdate;
|
||||||
event AvatarInterestUpdate OnAvatarInterestUpdate;
|
event AvatarInterestUpdate OnAvatarInterestUpdate;
|
||||||
|
event GrantUserFriendRights OnGrantUserRights;
|
||||||
|
|
||||||
event MuteListRequest OnMuteListRequest;
|
event MuteListRequest OnMuteListRequest;
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
public event MoneyTransferRequest OnMoneyTransferRequest;
|
public event MoneyTransferRequest OnMoneyTransferRequest;
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
@ -9720,6 +9721,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
|
Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PacketType.GrantUserRights:
|
||||||
|
GrantUserRightsPacket GrantUserRights =
|
||||||
|
(GrantUserRightsPacket)Pack;
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (m_checkPackets)
|
||||||
|
{
|
||||||
|
if (GrantUserRights.AgentData.SessionID != SessionId ||
|
||||||
|
GrantUserRights.AgentData.AgentID != AgentId)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights;
|
||||||
|
if (GrantUserRightsHandler != null)
|
||||||
|
GrantUserRightsHandler(this,
|
||||||
|
GrantUserRights.AgentData.AgentID,
|
||||||
|
GrantUserRights.Rights[0].AgentRelated,
|
||||||
|
GrantUserRights.Rights[0].RelatedRights);
|
||||||
|
break;
|
||||||
|
|
||||||
case PacketType.PlacesQuery:
|
case PacketType.PlacesQuery:
|
||||||
PlacesQueryPacket placesQueryPacket =
|
PlacesQueryPacket placesQueryPacket =
|
||||||
(PlacesQueryPacket)Pack;
|
(PlacesQueryPacket)Pack;
|
||||||
|
|
|
@ -395,6 +395,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
|
|
||||||
// if it leaves, we want to know, too
|
// if it leaves, we want to know, too
|
||||||
client.OnLogout += OnLogout;
|
client.OnLogout += OnLogout;
|
||||||
|
client.OnGrantUserRights += GrantUserFriendRights;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClientClosed(UUID AgentId, Scene scene)
|
private void ClientClosed(UUID AgentId, Scene scene)
|
||||||
|
@ -1108,7 +1110,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||||
// tell everyone that we are offline
|
// tell everyone that we are offline
|
||||||
SendPresenceState(remoteClient, fl, false);
|
SendPresenceState(remoteClient, fl, false);
|
||||||
}
|
}
|
||||||
|
private void GrantUserFriendRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
|
||||||
|
{
|
||||||
|
((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,6 +476,37 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (user == UUID.Zero) return false;
|
||||||
|
|
||||||
|
List<FriendListItem> profile = m_scene.CommsManager.GetUserFriendList(user);
|
||||||
|
foreach (FriendListItem item in profile)
|
||||||
|
{
|
||||||
|
m_log.Warn("IsFriendWithPerms called" + item.FriendPerms.ToString());
|
||||||
|
if(item.Friend == objectOwner)
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
protected bool IsEstateManager(UUID user)
|
protected bool IsEstateManager(UUID user)
|
||||||
{
|
{
|
||||||
|
@ -566,6 +597,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
if (user == objectOwner)
|
if (user == objectOwner)
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
|
||||||
|
if (IsFriendWithPerms(user, objectOwner))
|
||||||
|
return objectOwnerMask;
|
||||||
|
|
||||||
// Estate users should be able to edit anything in the sim
|
// Estate users should be able to edit anything in the sim
|
||||||
if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner))
|
if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner))
|
||||||
return objectOwnerMask;
|
return objectOwnerMask;
|
||||||
|
|
|
@ -179,6 +179,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
|
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
|
|
@ -758,6 +758,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
public event MoneyTransferRequest OnMoneyTransferRequest;
|
public event MoneyTransferRequest OnMoneyTransferRequest;
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
|
|
@ -283,6 +283,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
|
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
|
|
@ -191,6 +191,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
public event FriendActionDelegate OnDenyFriendRequest;
|
public event FriendActionDelegate OnDenyFriendRequest;
|
||||||
public event FriendshipTermination OnTerminateFriendship;
|
public event FriendshipTermination OnTerminateFriendship;
|
||||||
|
public event GrantUserFriendRights OnGrantUserRights;
|
||||||
|
|
||||||
public event EconomyDataRequest OnEconomyDataRequest;
|
public event EconomyDataRequest OnEconomyDataRequest;
|
||||||
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
public event MoneyBalanceRequest OnMoneyBalanceRequest;
|
||||||
|
|
Loading…
Reference in New Issue