29 using System.Collections.Generic;
31 using System.Reflection;
32 using System.Threading;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Scenes;
37 using OpenSim.Region.Framework.Interfaces;
38 using OpenSim.Server.Base;
39 using OpenSim.Services.Interfaces;
46 namespace OpenSim.Groups
48 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"GroupsServiceRemoteConnectorModule")]
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private bool m_Enabled =
false;
56 private List<Scene> m_Scenes;
68 m_UserManagement = uman;
74 private void Init(IConfigSource config)
77 m_Scenes =
new List<Scene>();
81 #region ISharedRegionModule
85 IConfig groupsConfig = config.Configs[
"Groups"];
86 if (groupsConfig == null)
89 if ((groupsConfig.GetBoolean(
"Enabled",
false) ==
false)
90 || (groupsConfig.GetString(
"ServicesConnectorModule",
string.Empty) != Name))
98 m_log.DebugFormat(
"[Groups.RemoteConnector]: Initializing {0}", this.Name);
103 get {
return "Groups Remote Service Connector"; }
106 public Type ReplaceableInterface
116 m_log.DebugFormat(
"[Groups.RemoteConnector]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName);
127 m_Scenes.Remove(scene);
135 if (m_UserManagement == null)
152 #region IGroupsServicesConnector
154 public UUID CreateGroup(UUID RequestingAgentID,
string name,
string charter,
bool showInList, UUID insigniaID,
int membershipFee,
bool openEnrollment,
155 bool allowPublish,
bool maturePublish, UUID founderID, out
string reason)
157 m_log.DebugFormat(
"[Groups.RemoteConnector]: Creating group {0}", name);
158 string r = string.Empty;
160 UUID groupID = m_CacheWrapper.CreateGroup(RequestingAgentID, delegate
162 return m_GroupsService.CreateGroup(RequestingAgentID.ToString(), name, charter, showInList, insigniaID,
163 membershipFee, openEnrollment, allowPublish, maturePublish, founderID, out r);
170 public bool UpdateGroup(
string RequestingAgentID, UUID groupID,
string charter,
bool showInList, UUID insigniaID,
int membershipFee,
171 bool openEnrollment,
bool allowPublish,
bool maturePublish, out
string reason)
173 string r = string.Empty;
175 bool success = m_CacheWrapper.UpdateGroup(groupID, delegate
177 return m_GroupsService.UpdateGroup(RequestingAgentID, groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish);
186 if (GroupID ==
UUID.Zero && (GroupName == null || GroupName != null && GroupName ==
string.Empty))
189 return m_CacheWrapper.GetGroupRecord(RequestingAgentID,GroupID,GroupName, delegate
191 return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName);
195 public List<DirGroupsReplyData>
FindGroups(
string RequestingAgentID,
string search)
198 return m_GroupsService.FindGroups(RequestingAgentID, search);
201 public bool AddAgentToGroup(
string RequestingAgentID,
string AgentID, UUID GroupID, UUID RoleID,
string token, out
string reason)
203 string agentFullID = AgentID;
204 m_log.DebugFormat(
"[Groups.RemoteConnector]: Add agent {0} to group {1}", agentFullID, GroupID);
205 string r = string.Empty;
207 bool success = m_CacheWrapper.AddAgentToGroup(RequestingAgentID, AgentID, GroupID, delegate
209 return m_GroupsService.AddAgentToGroup(RequestingAgentID, agentFullID, GroupID, RoleID, token, out r);
218 m_CacheWrapper.RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID, delegate
220 m_GroupsService.RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID);
227 m_CacheWrapper.SetAgentActiveGroup(AgentID, delegate
229 return m_GroupsService.SetAgentActiveGroup(RequestingAgentID, AgentID, GroupID);
235 return m_CacheWrapper.GetAgentActiveMembership(AgentID, delegate
237 return m_GroupsService.GetMembership(RequestingAgentID, AgentID, UUID.Zero);
243 return m_CacheWrapper.GetAgentGroupMembership(AgentID, GroupID, delegate
245 return m_GroupsService.GetMembership(RequestingAgentID, AgentID, GroupID);
251 return m_CacheWrapper.GetAgentGroupMemberships(AgentID, delegate
253 return m_GroupsService.GetMemberships(RequestingAgentID, AgentID);
260 return m_CacheWrapper.GetGroupMembers(RequestingAgentID, GroupID, delegate
262 return m_GroupsService.GetGroupMembers(RequestingAgentID, GroupID);
266 public bool AddGroupRole(
string RequestingAgentID, UUID groupID, UUID roleID,
string name,
string description,
string title, ulong powers, out
string reason)
268 string r = string.Empty;
269 bool success = m_CacheWrapper.AddGroupRole(groupID, roleID, description, name, powers, title, delegate
271 return m_GroupsService.AddGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers, out r);
278 public bool UpdateGroupRole(
string RequestingAgentID, UUID groupID, UUID roleID,
string name,
string description,
string title, ulong powers)
280 return m_CacheWrapper.UpdateGroupRole(groupID, roleID, name, description, title, powers, delegate
282 return m_GroupsService.UpdateGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers);
288 m_CacheWrapper.RemoveGroupRole(RequestingAgentID, groupID, roleID, delegate
290 m_GroupsService.RemoveGroupRole(RequestingAgentID, groupID, roleID);
294 public List<GroupRolesData>
GetGroupRoles(
string RequestingAgentID, UUID GroupID)
296 return m_CacheWrapper.GetGroupRoles(RequestingAgentID, GroupID, delegate
298 return m_GroupsService.GetGroupRoles(RequestingAgentID, GroupID);
304 return m_CacheWrapper.GetGroupRoleMembers(RequestingAgentID, GroupID, delegate
306 return m_GroupsService.GetGroupRoleMembers(RequestingAgentID, GroupID);
312 m_CacheWrapper.AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID, delegate
314 return m_GroupsService.AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
320 m_CacheWrapper.RemoveAgentFromGroupRole(RequestingAgentID, AgentID, GroupID, RoleID, delegate
322 return m_GroupsService.RemoveAgentFromGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
326 public List<GroupRolesData>
GetAgentGroupRoles(
string RequestingAgentID,
string AgentID, UUID GroupID)
328 return m_CacheWrapper.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID, delegate
330 return m_GroupsService.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID); ;
336 m_CacheWrapper.SetAgentActiveGroupRole(AgentID, GroupID, delegate
338 m_GroupsService.SetAgentActiveGroupRole(RequestingAgentID, AgentID, GroupID, RoleID);
342 public void UpdateMembership(
string RequestingAgentID,
string AgentID, UUID GroupID,
bool AcceptNotices,
bool ListInProfile)
344 m_CacheWrapper.UpdateMembership(AgentID, GroupID, AcceptNotices, ListInProfile, delegate
346 m_GroupsService.UpdateMembership(RequestingAgentID, AgentID, GroupID, AcceptNotices, ListInProfile);
350 public bool AddAgentToGroupInvite(
string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID,
string agentID)
352 return m_GroupsService.AddAgentToGroupInvite(RequestingAgentID, inviteID, groupID, roleID, agentID);
357 return m_GroupsService.GetAgentToGroupInvite(RequestingAgentID, inviteID);
362 m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID);
365 public bool AddGroupNotice(
string RequestingAgentID, UUID groupID, UUID noticeID,
string fromName,
string subject,
string message,
366 bool hasAttachment, byte attType,
string attName, UUID attItemID,
string attOwnerID)
369 notice.GroupID = groupID;
370 notice.Message = message;
372 notice.noticeData.AttachmentItemID = attItemID;
373 notice.noticeData.AttachmentName = attName;
374 notice.noticeData.AttachmentOwnerID = attOwnerID.ToString();
375 notice.noticeData.AttachmentType = attType;
376 notice.noticeData.FromName = fromName;
377 notice.noticeData.HasAttachment = hasAttachment;
378 notice.noticeData.NoticeID = noticeID;
379 notice.noticeData.Subject = subject;
380 notice.noticeData.Timestamp = (uint)Util.UnixTimeSinceEpoch();
382 return m_CacheWrapper.AddGroupNotice(groupID, noticeID, notice, delegate
384 return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message,
385 hasAttachment, attType, attName, attItemID, attOwnerID);
391 return m_CacheWrapper.GetGroupNotice(noticeID, delegate
393 return m_GroupsService.GetGroupNotice(RequestingAgentID, noticeID);
397 public List<ExtendedGroupNoticeData>
GetGroupNotices(
string RequestingAgentID, UUID GroupID)
399 return m_CacheWrapper.GetGroupNotices(GroupID, delegate
401 return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID);
void SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID)
bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID)
ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
List< GroupMembershipData > GetAgentGroupMemberships(string RequestingAgentID, string AgentID)
Get information about the groups to which a user belongs.
List< GroupRolesData > GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void UpdateMembership(string RequestingAgentID, string AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile)
ExtendedGroupMembershipData GetAgentActiveMembership(string RequestingAgentID, string AgentID)
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)
GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID)
GroupsServiceRemoteConnectorModule()
List< ExtendedGroupNoticeData > GetGroupNotices(string RequestingAgentID, UUID GroupID)
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason)
List< GroupRoleMembersData > GetGroupRoleMembers(string RequestingAgentID, UUID GroupID)
bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)
bool UpdateGroup(string RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, out string reason)
ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID)
Get information about a specific group to which the user belongs.
GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement uman)
void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
void RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
bool AddGroupNotice(string RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
void AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
This maintains the relationship between a UUID and a user name.
bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason)
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
List< DirGroupsReplyData > FindGroups(string RequestingAgentID, string search)
List< GroupMembersData > GetGroupMembers(string RequestingAgentID, UUID GroupID)
List< GroupRolesData > GetGroupRoles(string RequestingAgentID, UUID GroupID)