aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs95
1 files changed, 47 insertions, 48 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 1cb4747..98c7ed4 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -48,16 +48,16 @@ using OpenSim.Services.Interfaces;
48/*************************************************************************** 48/***************************************************************************
49 * Simian Data Map 49 * Simian Data Map
50 * =============== 50 * ===============
51 * 51 *
52 * OwnerID -> Type -> Key 52 * OwnerID -> Type -> Key
53 * ----------------------- 53 * -----------------------
54 * 54 *
55 * UserID -> Group -> ActiveGroup 55 * UserID -> Group -> ActiveGroup
56 * + GroupID 56 * + GroupID
57 * 57 *
58 * UserID -> GroupSessionDropped -> GroupID 58 * UserID -> GroupSessionDropped -> GroupID
59 * UserID -> GroupSessionInvited -> GroupID 59 * UserID -> GroupSessionInvited -> GroupID
60 * 60 *
61 * UserID -> GroupMember -> GroupID 61 * UserID -> GroupMember -> GroupID
62 * + SelectedRoleID [UUID] 62 * + SelectedRoleID [UUID]
63 * + AcceptNotices [bool] 63 * + AcceptNotices [bool]
@@ -65,9 +65,9 @@ using OpenSim.Services.Interfaces;
65 * + Contribution [int] 65 * + Contribution [int]
66 * 66 *
67 * UserID -> GroupRole[GroupID] -> RoleID 67 * UserID -> GroupRole[GroupID] -> RoleID
68 * 68 *
69 * 69 *
70 * GroupID -> Group -> GroupName 70 * GroupID -> Group -> GroupName
71 * + Charter 71 * + Charter
72 * + ShowInList 72 * + ShowInList
73 * + InsigniaID 73 * + InsigniaID
@@ -79,17 +79,17 @@ using OpenSim.Services.Interfaces;
79 * + EveryonePowers 79 * + EveryonePowers
80 * + OwnerRoleID 80 * + OwnerRoleID
81 * + OwnersPowers 81 * + OwnersPowers
82 * 82 *
83 * GroupID -> GroupRole -> RoleID 83 * GroupID -> GroupRole -> RoleID
84 * + Name 84 * + Name
85 * + Description 85 * + Description
86 * + Title 86 * + Title
87 * + Powers 87 * + Powers
88 * 88 *
89 * GroupID -> GroupMemberInvite -> InviteID 89 * GroupID -> GroupMemberInvite -> InviteID
90 * + AgentID 90 * + AgentID
91 * + RoleID 91 * + RoleID
92 * 92 *
93 * GroupID -> GroupNotice -> NoticeID 93 * GroupID -> GroupNotice -> NoticeID
94 * + TimeStamp [uint] 94 * + TimeStamp [uint]
95 * + FromName [string] 95 * + FromName [string]
@@ -106,12 +106,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
106 { 106 {
107 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 107 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
108 108
109 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | 109 public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
110 GroupPowers.Accountable | 110 GroupPowers.Accountable |
111 GroupPowers.JoinChat | 111 GroupPowers.JoinChat |
112 GroupPowers.AllowVoiceChat | 112 GroupPowers.AllowVoiceChat |
113 GroupPowers.ReceiveNotices | 113 GroupPowers.ReceiveNotices |
114 GroupPowers.StartProposal | 114 GroupPowers.StartProposal |
115 GroupPowers.VoteOnProposal; 115 GroupPowers.VoteOnProposal;
116 116
117 // Would this be cleaner as (GroupPowers)ulong.MaxValue; 117 // Would this be cleaner as (GroupPowers)ulong.MaxValue;
@@ -168,12 +168,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
168 private bool m_debugEnabled = false; 168 private bool m_debugEnabled = false;
169 169
170 private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>(); 170 private Dictionary<string, bool> m_pendingRequests = new Dictionary<string,bool>();
171 171
172 private ExpiringCache<string, OSDMap> m_memoryCache; 172 private ExpiringCache<string, OSDMap> m_memoryCache;
173 private int m_cacheTimeout = 30; 173 private int m_cacheTimeout = 30;
174 174
175 // private IUserAccountService m_accountService = null; 175 // private IUserAccountService m_accountService = null;
176 176
177 177
178 #region Region Module interfaceBase Members 178 #region Region Module interfaceBase Members
179 179
@@ -229,10 +229,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
229 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout); 229 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout);
230 } 230 }
231 231
232 232
233 233
234 m_memoryCache = new ExpiringCache<string,OSDMap>(); 234 m_memoryCache = new ExpiringCache<string,OSDMap>();
235 235
236 236
237 // If we got all the config options we need, lets start'er'up 237 // If we got all the config options we need, lets start'er'up
238 m_connectorEnabled = true; 238 m_connectorEnabled = true;
@@ -244,7 +244,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
244 244
245 public void Close() 245 public void Close()
246 { 246 {
247 m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Closing {0}", this.Name);
248 } 247 }
249 248
250 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) 249 public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene)
@@ -288,8 +287,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
288 /// <summary> 287 /// <summary>
289 /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. 288 /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
290 /// </summary> 289 /// </summary>
291 public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, 290 public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
292 int membershipFee, bool openEnrollment, bool allowPublish, 291 int membershipFee, bool openEnrollment, bool allowPublish,
293 bool maturePublish, UUID founderID) 292 bool maturePublish, UUID founderID)
294 { 293 {
295 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 294 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -314,7 +313,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
314 { 313 {
315 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); 314 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
316 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); 315 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
317 316
318 AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); 317 AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID);
319 318
320 return GroupID; 319 return GroupID;
@@ -326,8 +325,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
326 } 325 }
327 326
328 327
329 public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, 328 public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
330 UUID insigniaID, int membershipFee, bool openEnrollment, 329 UUID insigniaID, int membershipFee, bool openEnrollment,
331 bool allowPublish, bool maturePublish) 330 bool allowPublish, bool maturePublish)
332 { 331 {
333 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 332 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -351,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
351 } 350 }
352 351
353 352
354 public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, 353 public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
355 string title, ulong powers) 354 string title, ulong powers)
356 { 355 {
357 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 356 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -394,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
394 } 393 }
395 394
396 395
397 public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, 396 public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
398 string title, ulong powers) 397 string title, ulong powers)
399 { 398 {
400 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 399 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -435,7 +434,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
435 { 434 {
436 return null; 435 return null;
437 } 436 }
438 } 437 }
439 else if (!string.IsNullOrEmpty(groupName)) 438 else if (!string.IsNullOrEmpty(groupName))
440 { 439 {
441 if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) 440 if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap))
@@ -482,7 +481,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
482 { 481 {
483 MemberGroupProfile.Charter = groupProfile["Charter"].AsString(); 482 MemberGroupProfile.Charter = groupProfile["Charter"].AsString();
484 } 483 }
485 484
486 MemberGroupProfile.ShowInList = groupProfile["ShowInList"].AsString() == "1"; 485 MemberGroupProfile.ShowInList = groupProfile["ShowInList"].AsString() == "1";
487 MemberGroupProfile.InsigniaID = groupProfile["InsigniaID"].AsUUID(); 486 MemberGroupProfile.InsigniaID = groupProfile["InsigniaID"].AsUUID();
488 MemberGroupProfile.MembershipFee = groupProfile["MembershipFee"].AsInteger(); 487 MemberGroupProfile.MembershipFee = groupProfile["MembershipFee"].AsInteger();
@@ -490,7 +489,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
490 MemberGroupProfile.AllowPublish = groupProfile["AllowPublish"].AsBoolean(); 489 MemberGroupProfile.AllowPublish = groupProfile["AllowPublish"].AsBoolean();
491 MemberGroupProfile.MaturePublish = groupProfile["MaturePublish"].AsBoolean(); 490 MemberGroupProfile.MaturePublish = groupProfile["MaturePublish"].AsBoolean();
492 MemberGroupProfile.FounderID = groupProfile["FounderID"].AsUUID();; 491 MemberGroupProfile.FounderID = groupProfile["FounderID"].AsUUID();;
493 MemberGroupProfile.OwnerRole = groupProfile["OwnerRoleID"].AsUUID(); 492 MemberGroupProfile.OwnerRole = groupProfile["OwnerRoleID"].AsUUID();
494 493
495 Dictionary<UUID, OSDMap> Members; 494 Dictionary<UUID, OSDMap> Members;
496 if (SimianGetGenericEntries("GroupMember",groupID.ToString(), out Members)) 495 if (SimianGetGenericEntries("GroupMember",groupID.ToString(), out Members))
@@ -547,7 +546,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
547 { 546 {
548 GroupMemberInfo = new OSDMap(); 547 GroupMemberInfo = new OSDMap();
549 } 548 }
550 549
551 GroupMemberInfo["AcceptNotices"] = OSD.FromBoolean(acceptNotices); 550 GroupMemberInfo["AcceptNotices"] = OSD.FromBoolean(acceptNotices);
552 GroupMemberInfo["ListInProfile"] = OSD.FromBoolean(listInProfile); 551 GroupMemberInfo["ListInProfile"] = OSD.FromBoolean(listInProfile);
553 GroupMemberInfo["Contribution"] = OSD.FromInteger(0); 552 GroupMemberInfo["Contribution"] = OSD.FromInteger(0);
@@ -625,7 +624,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
625 // Remove Group Member information for this group 624 // Remove Group Member information for this group
626 SimianRemoveGenericEntry(agentID, "GroupMember", groupID.ToString()); 625 SimianRemoveGenericEntry(agentID, "GroupMember", groupID.ToString());
627 626
628 // By using a Simian Generics Type consisting of a prefix and a groupID, 627 // By using a Simian Generics Type consisting of a prefix and a groupID,
629 // combined with RoleID as key allows us to get a list of roles a particular member 628 // combined with RoleID as key allows us to get a list of roles a particular member
630 // of a group is assigned to. 629 // of a group is assigned to.
631 string GroupRoleMemberType = "GroupRole" + groupID.ToString(); 630 string GroupRoleMemberType = "GroupRole" + groupID.ToString();
@@ -697,7 +696,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
697 { 696 {
698 data.members = 0; 697 data.members = 0;
699 } 698 }
700 699
701 // TODO: sort results? 700 // TODO: sort results?
702 // data.searchOrder = order; 701 // data.searchOrder = order;
703 702
@@ -722,8 +721,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
722 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); 721 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
723 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); 722 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
724 data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean(); 723 data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean();
725 data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID(); 724 data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID();
726 725
727 /////////////////////////////// 726 ///////////////////////////////
728 // Agent Specific Information: 727 // Agent Specific Information:
729 // 728 //
@@ -731,7 +730,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
731 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) 730 if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
732 { 731 {
733 data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID); 732 data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID);
734 } 733 }
735 734
736 /////////////////////////////// 735 ///////////////////////////////
737 // Role Specific Information: 736 // Role Specific Information:
@@ -741,8 +740,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
741 { 740 {
742 data.GroupTitle = GroupRoleInfo["Title"].AsString(); 741 data.GroupTitle = GroupRoleInfo["Title"].AsString();
743 data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); 742 data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
744 } 743 }
745 744
746 /////////////////////////////// 745 ///////////////////////////////
747 // Group Specific Information: 746 // Group Specific Information:
748 // 747 //
@@ -760,7 +759,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
760 data.MembershipFee = GroupInfo["MembershipFee"].AsInteger(); 759 data.MembershipFee = GroupInfo["MembershipFee"].AsInteger();
761 data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean(); 760 data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean();
762 data.ShowInList = GroupInfo["ShowInList"].AsBoolean(); 761 data.ShowInList = GroupInfo["ShowInList"].AsBoolean();
763 } 762 }
764 } 763 }
765 764
766 return data; 765 return data;
@@ -795,7 +794,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
795 memberships.Add(GetAgentGroupMembership(requestingAgentID, agentID, UUID.Parse(key))); 794 memberships.Add(GetAgentGroupMembership(requestingAgentID, agentID, UUID.Parse(key)));
796 } 795 }
797 } 796 }
798 797
799 return memberships; 798 return memberships;
800 } 799 }
801 800
@@ -1018,7 +1017,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1018 Notice["BinaryBucket"] = OSD.FromBinary(binaryBucket); 1017 Notice["BinaryBucket"] = OSD.FromBinary(binaryBucket);
1019 1018
1020 SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice); 1019 SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice);
1021 1020
1022 } 1021 }
1023 #endregion 1022 #endregion
1024 1023
@@ -1251,7 +1250,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1251 { "OwnerID", ownerID.ToString() }, 1250 { "OwnerID", ownerID.ToString() },
1252 { "Type", type } 1251 { "Type", type }
1253 }; 1252 };
1254 1253
1255 1254
1256 1255
1257 OSDMap response = CachedPostRequest(requestArgs); 1256 OSDMap response = CachedPostRequest(requestArgs);
@@ -1358,7 +1357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1358 || requestArgs["RequestMethod"] == "AddGeneric") 1357 || requestArgs["RequestMethod"] == "AddGeneric")
1359 { 1358 {
1360 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache"); 1359 m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: clearing generics cache");
1361 1360
1362 // Any and all updates cause the cache to clear 1361 // Any and all updates cause the cache to clear
1363 m_memoryCache.Clear(); 1362 m_memoryCache.Clear();
1364 1363
@@ -1384,14 +1383,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1384 { 1383 {
1385 if (m_memoryCache.TryGetValue(CacheKey, out response)) 1384 if (m_memoryCache.TryGetValue(CacheKey, out response))
1386 return response; 1385 return response;
1387 1386
1388 if (! m_pendingRequests.ContainsKey(CacheKey)) 1387 if (! m_pendingRequests.ContainsKey(CacheKey))
1389 { 1388 {
1390 m_pendingRequests.Add(CacheKey,true); 1389 m_pendingRequests.Add(CacheKey,true);
1391 firstRequest = true; 1390 firstRequest = true;
1392 } 1391 }
1393 } 1392 }
1394 1393
1395 if (firstRequest) 1394 if (firstRequest)
1396 { 1395 {
1397 // if it wasn't in the cache, pass the request to the Simian Grid Services 1396 // if it wasn't in the cache, pass the request to the Simian Grid Services
@@ -1403,7 +1402,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1403 { 1402 {
1404 m_log.ErrorFormat("[SIMIAN GROUPS CONNECTOR]: request failed {0}", CacheKey); 1403 m_log.ErrorFormat("[SIMIAN GROUPS CONNECTOR]: request failed {0}", CacheKey);
1405 } 1404 }
1406 1405
1407 // and cache the response 1406 // and cache the response
1408 lock (m_memoryCache) 1407 lock (m_memoryCache)
1409 { 1408 {
@@ -1421,7 +1420,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1421 // { 1420 // {
1422 // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache"); 1421 // m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: query not in the cache");
1423 // Util.PrintCallStack(); 1422 // Util.PrintCallStack();
1424 1423
1425 // // if it wasn't in the cache, pass the request to the Simian Grid Services 1424 // // if it wasn't in the cache, pass the request to the Simian Grid Services
1426 // response = WebUtil.PostToService(m_groupsServerURI, requestArgs); 1425 // response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1427 1426