29 using System.Collections.Generic;
31 using System.Reflection;
34 using OpenSim.Framework;
35 using OpenSim.Region.Framework.Scenes;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Services.Interfaces;
44 namespace OpenSim.Groups
46 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"GroupsServiceLocalConnectorModule")]
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 private bool m_Enabled =
false;
54 private List<Scene> m_Scenes;
65 m_UserManagement = uman;
70 private void Init(IConfigSource config)
73 m_Scenes =
new List<Scene>();
76 #region ISharedRegionModule
80 IConfig groupsConfig = config.Configs[
"Groups"];
81 if (groupsConfig == null)
84 if ((groupsConfig.GetBoolean(
"Enabled",
false) ==
false)
85 || (groupsConfig.GetString(
"ServicesConnectorModule",
string.Empty) != Name))
93 m_log.DebugFormat(
"[Groups]: Initializing {0}", this.Name);
98 get {
return "Groups Local Service Connector"; }
101 public Type ReplaceableInterface
111 m_log.DebugFormat(
"[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
122 m_Scenes.Remove(scene);
130 if (m_UserManagement == null)
147 #region IGroupsServicesConnector
149 public UUID CreateGroup(UUID RequestingAgentID,
string name,
string charter,
bool showInList, UUID insigniaID,
int membershipFee,
bool openEnrollment,
150 bool allowPublish,
bool maturePublish, UUID founderID, out
string reason)
152 m_log.DebugFormat(
"[Groups]: Creating group {0}", name);
153 reason = string.Empty;
154 return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
155 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out reason);
158 public bool UpdateGroup(
string RequestingAgentID, UUID groupID,
string charter,
bool showInList, UUID insigniaID,
int membershipFee,
159 bool openEnrollment,
bool allowPublish,
bool maturePublish, out
string reason)
161 reason = string.Empty;
162 m_GroupsService.UpdateGroup(RequestingAgentID, groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish);
168 if (GroupID !=
UUID.Zero)
169 return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID);
170 else if (GroupName != null)
171 return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupName);
176 public List<DirGroupsReplyData>
FindGroups(
string RequestingAgentID,
string search)
178 return m_GroupsService.FindGroups(RequestingAgentID, search);
183 List<ExtendedGroupMembersData> _members = m_GroupsService.GetGroupMembers(RequestingAgentID, GroupID);
184 if (_members != null && _members.Count > 0)
186 List<GroupMembersData> members = _members.ConvertAll<
GroupMembersData>(
new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData));
190 return new List<GroupMembersData>();
193 public bool AddGroupRole(
string RequestingAgentID, UUID groupID, UUID roleID,
string name,
string description,
string title, ulong powers, out
string reason)
195 return m_GroupsService.AddGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers, out reason);
198 public bool UpdateGroupRole(
string RequestingAgentID, UUID groupID, UUID roleID,
string name,
string description,
string title, ulong powers)
200 return m_GroupsService.UpdateGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers);
205 m_GroupsService.RemoveGroupRole(RequestingAgentID, groupID, roleID);
208 public List<GroupRolesData>
GetGroupRoles(
string RequestingAgentID, UUID GroupID)
210 return m_GroupsService.GetGroupRoles(RequestingAgentID, GroupID);
215 List<ExtendedGroupRoleMembersData> _rm = m_GroupsService.GetGroupRoleMembers(RequestingAgentID, GroupID);
216 if (_rm != null && _rm.Count > 0)
218 List<GroupRoleMembersData> rm = _rm.ConvertAll<
GroupRoleMembersData>(
new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData));
222 return new List<GroupRoleMembersData>();
226 public bool AddAgentToGroup(
string RequestingAgentID,
string AgentID, UUID GroupID, UUID RoleID,
string token, out
string reason)
228 return m_GroupsService.AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, token, out reason);
233 m_GroupsService.RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
236 public bool AddAgentToGroupInvite(
string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID,
string agentID)
238 return m_GroupsService.AddAgentToGroupInvite(RequestingAgentID, inviteID, groupID, roleID, agentID);
243 return m_GroupsService.GetAgentToGroupInvite(RequestingAgentID, inviteID); ;
248 m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID);
253 m_GroupsService.AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
258 m_GroupsService.RemoveAgentFromGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
261 public List<GroupRolesData>
GetAgentGroupRoles(
string RequestingAgentID,
string AgentID, UUID GroupID)
263 return m_GroupsService.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID);
268 m_GroupsService.SetAgentActiveGroup(RequestingAgentID, AgentID, GroupID);
273 return m_GroupsService.GetAgentActiveMembership(RequestingAgentID, AgentID);
278 m_GroupsService.SetAgentActiveGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
281 public void UpdateMembership(
string RequestingAgentID,
string AgentID, UUID GroupID,
bool AcceptNotices,
bool ListInProfile)
283 m_GroupsService.UpdateMembership(RequestingAgentID, AgentID, GroupID, AcceptNotices, ListInProfile);
288 return m_GroupsService.GetAgentGroupMembership(RequestingAgentID, AgentID, GroupID); ;
293 return m_GroupsService.GetAgentGroupMemberships(RequestingAgentID, AgentID);
296 public bool AddGroupNotice(
string RequestingAgentID, UUID groupID, UUID noticeID,
string fromName,
string subject,
string message,
297 bool hasAttachment, byte attType,
string attName, UUID attItemID,
string attOwnerID)
299 return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
300 hasAttachment, attType, attName, attItemID, attOwnerID);
305 GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(RequestingAgentID, noticeID);
319 public List<ExtendedGroupNoticeData>
GetGroupNotices(
string RequestingAgentID, UUID GroupID)
321 return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID);
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
void UpdateMembership(string RequestingAgentID, string AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
List< ExtendedGroupNoticeData > GetGroupNotices(string RequestingAgentID, UUID GroupID)
List< GroupRolesData > GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
List< GroupMembershipData > GetAgentGroupMemberships(string RequestingAgentID, string AgentID)
Get information about the groups to which a user belongs.
void AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID)
Get information about a specific group to which the user belongs.
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason)
List< GroupRolesData > GetGroupRoles(string RequestingAgentID, UUID GroupID)
GroupsServiceLocalConnectorModule()
void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
void SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID)
void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID, out string reason)
bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
List< GroupRoleMembersData > GetGroupRoleMembers(string RequestingAgentID, UUID GroupID)
ExtendedGroupMembershipData GetAgentActiveMembership(string RequestingAgentID, string AgentID)
List< GroupMembersData > GetGroupMembers(string RequestingAgentID, UUID GroupID)
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
GroupsServiceLocalConnectorModule(IConfigSource config, IUserManagement uman)
This maintains the relationship between a UUID and a user name.
List< DirGroupsReplyData > FindGroups(string RequestingAgentID, string search)
bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)