aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-11-05 02:09:07 +0000
committerMelanie2009-11-05 02:09:07 +0000
commit83b4b4440b7becb405840bc69d665e260fdecea0 (patch)
treea623dc9c6d82bfb96d1db978d2464e3cbaf4d0ca
parentSeparate folder and item limit for UDP inventory packets. Folder limit is (diff)
downloadopensim-SC-83b4b4440b7becb405840bc69d665e260fdecea0.zip
opensim-SC-83b4b4440b7becb405840bc69d665e260fdecea0.tar.gz
opensim-SC-83b4b4440b7becb405840bc69d665e260fdecea0.tar.bz2
opensim-SC-83b4b4440b7becb405840bc69d665e260fdecea0.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs1
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs2
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs34
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs1
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs1
10 files changed, 71 insertions, 3 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
index 3c3c247..0cae3dd 100644
--- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
+++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs
@@ -676,6 +676,7 @@ namespace OpenSim.Client.MXP.ClientStack
676 public event FriendActionDelegate OnApproveFriendRequest; 676 public event FriendActionDelegate OnApproveFriendRequest;
677 public event FriendActionDelegate OnDenyFriendRequest; 677 public event FriendActionDelegate OnDenyFriendRequest;
678 public event FriendshipTermination OnTerminateFriendship; 678 public event FriendshipTermination OnTerminateFriendship;
679 public event GrantUserFriendRights OnGrantUserRights;
679 public event MoneyTransferRequest OnMoneyTransferRequest; 680 public event MoneyTransferRequest OnMoneyTransferRequest;
680 public event EconomyDataRequest OnEconomyDataRequest; 681 public event EconomyDataRequest OnEconomyDataRequest;
681 public event MoneyBalanceRequest OnMoneyBalanceRequest; 682 public event MoneyBalanceRequest OnMoneyBalanceRequest;
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
index 81ebf31..fb87c15 100644
--- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
+++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs
@@ -327,6 +327,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
327 public event FriendActionDelegate OnApproveFriendRequest = delegate { }; 327 public event FriendActionDelegate OnApproveFriendRequest = delegate { };
328 public event FriendActionDelegate OnDenyFriendRequest = delegate { }; 328 public event FriendActionDelegate OnDenyFriendRequest = delegate { };
329 public event FriendshipTermination OnTerminateFriendship = delegate { }; 329 public event FriendshipTermination OnTerminateFriendship = delegate { };
330 public event GrantUserFriendRights OnGrantUserRights = delegate { };
330 public event MoneyTransferRequest OnMoneyTransferRequest = delegate { }; 331 public event MoneyTransferRequest OnMoneyTransferRequest = delegate { };
331 public event EconomyDataRequest OnEconomyDataRequest = delegate { }; 332 public event EconomyDataRequest OnEconomyDataRequest = delegate { };
332 public event MoneyBalanceRequest OnMoneyBalanceRequest = delegate { }; 333 public event MoneyBalanceRequest OnMoneyBalanceRequest = delegate { };
@@ -406,6 +407,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
406 public event PlacesQuery OnPlacesQuery = delegate { }; 407 public event PlacesQuery OnPlacesQuery = delegate { };
407 408
408 409
410
409 public void SetDebugPacketLevel(int newDebug) 411 public void SetDebugPacketLevel(int newDebug)
410 { 412 {
411 throw new System.NotImplementedException(); 413 throw new System.NotImplementedException();
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 0f88b93..ee7ab87 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -446,6 +446,7 @@ namespace OpenSim.Framework
446 public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes); 446 public delegate void AvatarNotesUpdate(IClientAPI client, UUID targetID, string notes);
447 public delegate void MuteListRequest(IClientAPI client, uint muteCRC); 447 public delegate void MuteListRequest(IClientAPI client, uint muteCRC);
448 public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); 448 public delegate void AvatarInterestUpdate(IClientAPI client, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
449 public delegate void GrantUserFriendRights(IClientAPI client, UUID requester, UUID target, int rights);
449 public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client); 450 public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
450 451
451 public delegate void AgentFOV(IClientAPI client, float verticalAngle); 452 public delegate void AgentFOV(IClientAPI client, float verticalAngle);
@@ -1023,6 +1024,7 @@ namespace OpenSim.Framework
1023 event PickInfoUpdate OnPickInfoUpdate; 1024 event PickInfoUpdate OnPickInfoUpdate;
1024 event AvatarNotesUpdate OnAvatarNotesUpdate; 1025 event AvatarNotesUpdate OnAvatarNotesUpdate;
1025 event AvatarInterestUpdate OnAvatarInterestUpdate; 1026 event AvatarInterestUpdate OnAvatarInterestUpdate;
1027 event GrantUserFriendRights OnGrantUserRights;
1026 1028
1027 event MuteListRequest OnMuteListRequest; 1029 event MuteListRequest OnMuteListRequest;
1028 1030
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 70abe77..34cad7b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -220,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
220 public event FriendActionDelegate OnApproveFriendRequest; 220 public event FriendActionDelegate OnApproveFriendRequest;
221 public event FriendActionDelegate OnDenyFriendRequest; 221 public event FriendActionDelegate OnDenyFriendRequest;
222 public event FriendshipTermination OnTerminateFriendship; 222 public event FriendshipTermination OnTerminateFriendship;
223 public event GrantUserFriendRights OnGrantUserRights;
223 public event MoneyTransferRequest OnMoneyTransferRequest; 224 public event MoneyTransferRequest OnMoneyTransferRequest;
224 public event EconomyDataRequest OnEconomyDataRequest; 225 public event EconomyDataRequest OnEconomyDataRequest;
225 public event MoneyBalanceRequest OnMoneyBalanceRequest; 226 public event MoneyBalanceRequest OnMoneyBalanceRequest;
@@ -9719,7 +9720,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9719 Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText), 9720 Utils.BytesToString(avatarInterestUpdate.PropertiesData.SkillsText),
9720 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText)); 9721 Utils.BytesToString(avatarInterestUpdate.PropertiesData.LanguagesText));
9721 break; 9722 break;
9722 9723
9724 case PacketType.GrantUserRights:
9725 GrantUserRightsPacket GrantUserRights =
9726 (GrantUserRightsPacket)Pack;
9727 #region Packet Session and User Check
9728 if (m_checkPackets)
9729 {
9730 if (GrantUserRights.AgentData.SessionID != SessionId ||
9731 GrantUserRights.AgentData.AgentID != AgentId)
9732 break;
9733 }
9734 #endregion
9735 GrantUserFriendRights GrantUserRightsHandler = OnGrantUserRights;
9736 if (GrantUserRightsHandler != null)
9737 GrantUserRightsHandler(this,
9738 GrantUserRights.AgentData.AgentID,
9739 GrantUserRights.Rights[0].AgentRelated,
9740 GrantUserRights.Rights[0].RelatedRights);
9741 break;
9742
9723 case PacketType.PlacesQuery: 9743 case PacketType.PlacesQuery:
9724 PlacesQueryPacket placesQueryPacket = 9744 PlacesQueryPacket placesQueryPacket =
9725 (PlacesQueryPacket)Pack; 9745 (PlacesQueryPacket)Pack;
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index fc7d63a..c6fd72e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -395,6 +395,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
395 395
396 // if it leaves, we want to know, too 396 // if it leaves, we want to know, too
397 client.OnLogout += OnLogout; 397 client.OnLogout += OnLogout;
398 client.OnGrantUserRights += GrantUserFriendRights;
399
398 } 400 }
399 401
400 private void ClientClosed(UUID AgentId, Scene scene) 402 private void ClientClosed(UUID AgentId, Scene scene)
@@ -1108,7 +1110,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
1108 // tell everyone that we are offline 1110 // tell everyone that we are offline
1109 SendPresenceState(remoteClient, fl, false); 1111 SendPresenceState(remoteClient, fl, false);
1110 } 1112 }
1111 } 1113 private void GrantUserFriendRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
1112 1114 {
1115 ((Scene)remoteClient.Scene).CommsManager.UpdateUserFriendPerms(requester, target, (uint)rights);
1116 }
1117 }
1113 #endregion 1118 #endregion
1114} 1119}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index fe9de1b..effe1f0 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -476,6 +476,37 @@ namespace OpenSim.Region.CoreModules.World.Permissions
476 476
477 return false; 477 return false;
478 } 478 }
479 protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
480 {
481
482 if (user == UUID.Zero) return false;
483
484 List<FriendListItem> profile = m_scene.CommsManager.GetUserFriendList(user);
485 foreach (FriendListItem item in profile)
486 {
487 m_log.Warn("IsFriendWithPerms called" + item.FriendPerms.ToString());
488 if(item.Friend == objectOwner)
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 }
508 return false;
509 }
479 510
480 protected bool IsEstateManager(UUID user) 511 protected bool IsEstateManager(UUID user)
481 { 512 {
@@ -565,6 +596,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
565 // Object owners should be able to edit their own content 596 // Object owners should be able to edit their own content
566 if (user == objectOwner) 597 if (user == objectOwner)
567 return objectOwnerMask; 598 return objectOwnerMask;
599
600 if (IsFriendWithPerms(user, objectOwner))
601 return objectOwnerMask;
568 602
569 // Estate users should be able to edit anything in the sim 603 // Estate users should be able to edit anything in the sim
570 if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner)) 604 if (IsEstateManager(user) && m_RegionOwnerIsGod && !IsAdministrator(objectOwner))
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 5891c7e..9754da3 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -179,6 +179,7 @@ namespace OpenSim.Region.Examples.SimpleModule
179 public event FriendActionDelegate OnApproveFriendRequest; 179 public event FriendActionDelegate OnApproveFriendRequest;
180 public event FriendActionDelegate OnDenyFriendRequest; 180 public event FriendActionDelegate OnDenyFriendRequest;
181 public event FriendshipTermination OnTerminateFriendship; 181 public event FriendshipTermination OnTerminateFriendship;
182 public event GrantUserFriendRights OnGrantUserRights;
182 183
183 public event EconomyDataRequest OnEconomyDataRequest; 184 public event EconomyDataRequest OnEconomyDataRequest;
184 public event MoneyBalanceRequest OnMoneyBalanceRequest; 185 public event MoneyBalanceRequest OnMoneyBalanceRequest;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index f1bd705..6c3e7eb 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -758,6 +758,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
758 public event FriendActionDelegate OnApproveFriendRequest; 758 public event FriendActionDelegate OnApproveFriendRequest;
759 public event FriendActionDelegate OnDenyFriendRequest; 759 public event FriendActionDelegate OnDenyFriendRequest;
760 public event FriendshipTermination OnTerminateFriendship; 760 public event FriendshipTermination OnTerminateFriendship;
761 public event GrantUserFriendRights OnGrantUserRights;
761 public event MoneyTransferRequest OnMoneyTransferRequest; 762 public event MoneyTransferRequest OnMoneyTransferRequest;
762 public event EconomyDataRequest OnEconomyDataRequest; 763 public event EconomyDataRequest OnEconomyDataRequest;
763 public event MoneyBalanceRequest OnMoneyBalanceRequest; 764 public event MoneyBalanceRequest OnMoneyBalanceRequest;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index cf81198..cf36d08 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -283,6 +283,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
283 public event FriendActionDelegate OnApproveFriendRequest; 283 public event FriendActionDelegate OnApproveFriendRequest;
284 public event FriendActionDelegate OnDenyFriendRequest; 284 public event FriendActionDelegate OnDenyFriendRequest;
285 public event FriendshipTermination OnTerminateFriendship; 285 public event FriendshipTermination OnTerminateFriendship;
286 public event GrantUserFriendRights OnGrantUserRights;
286 287
287 public event EconomyDataRequest OnEconomyDataRequest; 288 public event EconomyDataRequest OnEconomyDataRequest;
288 public event MoneyBalanceRequest OnMoneyBalanceRequest; 289 public event MoneyBalanceRequest OnMoneyBalanceRequest;
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 9ec9311..27025d9 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -191,6 +191,7 @@ namespace OpenSim.Tests.Common.Mock
191 public event FriendActionDelegate OnApproveFriendRequest; 191 public event FriendActionDelegate OnApproveFriendRequest;
192 public event FriendActionDelegate OnDenyFriendRequest; 192 public event FriendActionDelegate OnDenyFriendRequest;
193 public event FriendshipTermination OnTerminateFriendship; 193 public event FriendshipTermination OnTerminateFriendship;
194 public event GrantUserFriendRights OnGrantUserRights;
194 195
195 public event EconomyDataRequest OnEconomyDataRequest; 196 public event EconomyDataRequest OnEconomyDataRequest;
196 public event MoneyBalanceRequest OnMoneyBalanceRequest; 197 public event MoneyBalanceRequest OnMoneyBalanceRequest;