aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSnoopy Pfeffer2012-04-11 18:52:07 +0200
committerSnoopy Pfeffer2012-04-11 18:52:07 +0200
commit1f4d3d35822c5ad3dbdd5f363014f1bf9afebdc6 (patch)
tree0223bc4d3cdf6fc359208fdcb233d2ecc7106346
parentHGFriendsModule: add the scaffolding for supporting permissions pertaining to... (diff)
downloadopensim-SC_OLD-1f4d3d35822c5ad3dbdd5f363014f1bf9afebdc6.zip
opensim-SC_OLD-1f4d3d35822c5ad3dbdd5f363014f1bf9afebdc6.tar.gz
opensim-SC_OLD-1f4d3d35822c5ad3dbdd5f363014f1bf9afebdc6.tar.bz2
opensim-SC_OLD-1f4d3d35822c5ad3dbdd5f363014f1bf9afebdc6.tar.xz
HGFriendsModule: Added optional user level based restriction to send friendship invitations to foreign users.
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs24
-rw-r--r--bin/config-include/GridCommon.ini.example4
-rw-r--r--bin/config-include/StandaloneCommon.ini.example4
3 files changed, 28 insertions, 4 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index ddb6a71..f8fbbbb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private int m_levelHGFriends = 0;
54
53 IUserManagement m_uMan; 55 IUserManagement m_uMan;
54 public IUserManagement UserManagementModule 56 public IUserManagement UserManagementModule
55 { 57 {
@@ -95,6 +97,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
95 IConfig friendsConfig = config.Configs["HGFriendsModule"]; 97 IConfig friendsConfig = config.Configs["HGFriendsModule"];
96 if (friendsConfig != null) 98 if (friendsConfig != null)
97 { 99 {
100 m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0);
101
98 // TODO: read in all config variables pertaining to 102 // TODO: read in all config variables pertaining to
99 // HG friendship permissions 103 // HG friendship permissions
100 } 104 }
@@ -126,10 +130,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
126 UUID principalID = new UUID(im.fromAgentID); 130 UUID principalID = new UUID(im.fromAgentID);
127 UUID friendID = new UUID(im.toAgentID); 131 UUID friendID = new UUID(im.toAgentID);
128 132
129 // TODO: CHECK IF friendID is foreigner and if principalID has the permission 133 // Check if friendID is foreigner and if principalID has the permission
130 // to request these kinds of friendships. If not, return immediately. 134 // to request friendships with foreigners. If not, return immediately.
131 // Maybe you want to let the client know too with 135 if (!UserManagementModule.IsLocalGridUser(friendID))
132 // client.SendAlertMessage 136 {
137 ScenePresence avatar = null;
138 client.Scene.TryGetScenePresence(principalID, out avatar);
139
140 if (avatar == null)
141 return;
142
143 if (avatar.UserLevel < m_levelHGFriends)
144 {
145 client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false);
146 return;
147 }
148 }
133 } 149 }
134 150
135 base.OnInstantMessage(client, im); 151 base.OnInstantMessage(client, im);
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index fa6f525..8d7f6fc 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -137,6 +137,10 @@
137 ;; uncomment the next line. You may want to do this on sims that have licensed content. 137 ;; uncomment the next line. You may want to do this on sims that have licensed content.
138 ; OutboundPermission = False 138 ; OutboundPermission = False
139 139
140[HGFriendsModule]
141 ; User level required to be able to send friendship invitations to foreign users
142 ;LevelHGFriends = 0;
143
140[UserAgentService] 144[UserAgentService]
141 ; 145 ;
142 ; === HG ONLY === 146 ; === HG ONLY ===
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example
index 8fe64df..e4bc548 100644
--- a/bin/config-include/StandaloneCommon.ini.example
+++ b/bin/config-include/StandaloneCommon.ini.example
@@ -61,6 +61,10 @@
61 ;; uncomment the next line. You may want to do this on sims that have licensed content. 61 ;; uncomment the next line. You may want to do this on sims that have licensed content.
62 ; OutboundPermission = False 62 ; OutboundPermission = False
63 63
64[HGFriendsModule]
65 ; User level required to be able to send friendship invitations to foreign users
66 ;LevelHGFriends = 0;
67
64[GridService] 68[GridService]
65 ;; For in-memory region storage (default) 69 ;; For in-memory region storage (default)
66 StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" 70 StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"