From 0898be5750a9e5f0cfab566a34b65e4a227d82e6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 31 Jan 2011 22:54:36 +0000
Subject: Change SimianGroupsServicesConnectorModule.GetAgentGroupMembership()
so that it returns null if the user isn't a member of the group.
This matches the behaviour of the same method for Flotsam Groups. This is the behaviour assumed by existing code.
Method doc also added to IGroupsServicesConnector to the make the contract clear.
---
.../XmlRpcGroups/IGroupsServicesConnector.cs | 19 +++++++
.../SimianGroupsServicesConnectorModule.cs | 66 +++++++++++-----------
2 files changed, 52 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
index 5c779de..6d26075 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs
@@ -63,7 +63,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
void SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile);
+ ///
+ /// Get information about a specific group to which the user belongs.
+ ///
+ /// The agent requesting the information.
+ /// The agent requested.
+ /// The group requested.
+ ///
+ /// If the user is a member of the group then the data structure is returned. If not, then null is returned.
+ ///
GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
+
+ ///
+ /// Get information about the groups to which a user belongs.
+ ///
+ /// The agent requesting the information.
+ /// The agent requested.
+ ///
+ /// Information about the groups to which the user belongs. If the user belongs to no groups then an empty
+ /// list is returned.
+ ///
List GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID);
void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 0d265f2..81725c5 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -704,7 +704,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
}
-
return findings;
}
@@ -712,54 +711,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
- GroupMembershipData data = new GroupMembershipData();
-
- ///////////////////////////////
- // Agent Specific Information:
- //
- OSDMap UserActiveGroup;
- if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
- {
- data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID);
- }
+ GroupMembershipData data = null;
+ bool foundData = false;
OSDMap UserGroupMemberInfo;
if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
{
+ data = new GroupMembershipData();
data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
data.ListInProfile = UserGroupMemberInfo["ListInProfile"].AsBoolean();
- data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID();
+ data.ActiveRole = UserGroupMemberInfo["SelectedRoleID"].AsUUID();
+
+ ///////////////////////////////
+ // Agent Specific Information:
+ //
+ OSDMap UserActiveGroup;
+ if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
+ {
+ data.Active = UserActiveGroup["GroupID"].AsUUID().Equals(groupID);
+ }
///////////////////////////////
// Role Specific Information:
//
-
OSDMap GroupRoleInfo;
if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo))
{
data.GroupTitle = GroupRoleInfo["Title"].AsString();
data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
- }
- }
-
- ///////////////////////////////
- // Group Specific Information:
- //
- OSDMap GroupInfo;
- string GroupName;
- if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
- {
- data.GroupID = groupID;
- data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
- data.Charter = GroupInfo["Charter"].AsString();
- data.FounderID = GroupInfo["FounderID"].AsUUID();
- data.GroupName = GroupName;
- data.GroupPicture = GroupInfo["InsigniaID"].AsUUID();
- data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean();
- data.MembershipFee = GroupInfo["MembershipFee"].AsInteger();
- data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean();
- data.ShowInList = GroupInfo["ShowInList"].AsBoolean();
+ }
+
+ ///////////////////////////////
+ // Group Specific Information:
+ //
+ OSDMap GroupInfo;
+ string GroupName;
+ if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
+ {
+ data.GroupID = groupID;
+ data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
+ data.Charter = GroupInfo["Charter"].AsString();
+ data.FounderID = GroupInfo["FounderID"].AsUUID();
+ data.GroupName = GroupName;
+ data.GroupPicture = GroupInfo["InsigniaID"].AsUUID();
+ data.MaturePublish = GroupInfo["MaturePublish"].AsBoolean();
+ data.MembershipFee = GroupInfo["MembershipFee"].AsInteger();
+ data.OpenEnrollment = GroupInfo["OpenEnrollment"].AsBoolean();
+ data.ShowInList = GroupInfo["ShowInList"].AsBoolean();
+ }
}
return data;
--
cgit v1.1