diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Addons/Groups/Local | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Addons/Groups/Local')
-rw-r--r-- | OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs | 326 |
1 files changed, 326 insertions, 0 deletions
diff --git a/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs new file mode 100644 index 0000000..8e30df5 --- /dev/null +++ b/OpenSim/Addons/Groups/Local/GroupsServiceLocalConnectorModule.cs | |||
@@ -0,0 +1,326 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Linq; | ||
31 | using System.Reflection; | ||
32 | using System.Text; | ||
33 | |||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | using OpenMetaverse; | ||
40 | using Mono.Addins; | ||
41 | using log4net; | ||
42 | using Nini.Config; | ||
43 | |||
44 | namespace OpenSim.Groups | ||
45 | { | ||
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsServiceLocalConnectorModule")] | ||
47 | public class GroupsServiceLocalConnectorModule : ISharedRegionModule, IGroupsServicesConnector | ||
48 | { | ||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private bool m_Enabled = false; | ||
52 | private GroupsService m_GroupsService; | ||
53 | private IUserManagement m_UserManagement; | ||
54 | private List<Scene> m_Scenes; | ||
55 | private ForeignImporter m_ForeignImporter; | ||
56 | |||
57 | #region constructors | ||
58 | public GroupsServiceLocalConnectorModule() | ||
59 | { | ||
60 | } | ||
61 | |||
62 | public GroupsServiceLocalConnectorModule(IConfigSource config, IUserManagement uman) | ||
63 | { | ||
64 | Init(config); | ||
65 | m_UserManagement = uman; | ||
66 | m_ForeignImporter = new ForeignImporter(uman); | ||
67 | } | ||
68 | #endregion | ||
69 | |||
70 | private void Init(IConfigSource config) | ||
71 | { | ||
72 | m_GroupsService = new GroupsService(config); | ||
73 | m_Scenes = new List<Scene>(); | ||
74 | } | ||
75 | |||
76 | #region ISharedRegionModule | ||
77 | |||
78 | public void Initialise(IConfigSource config) | ||
79 | { | ||
80 | IConfig groupsConfig = config.Configs["Groups"]; | ||
81 | if (groupsConfig == null) | ||
82 | return; | ||
83 | |||
84 | if ((groupsConfig.GetBoolean("Enabled", false) == false) | ||
85 | || (groupsConfig.GetString("ServicesConnectorModule", string.Empty) != Name)) | ||
86 | { | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | Init(config); | ||
91 | m_Enabled = true; | ||
92 | |||
93 | m_log.DebugFormat("[Groups]: Initializing {0}", this.Name); | ||
94 | } | ||
95 | |||
96 | public string Name | ||
97 | { | ||
98 | get { return "Groups Local Service Connector"; } | ||
99 | } | ||
100 | |||
101 | public Type ReplaceableInterface | ||
102 | { | ||
103 | get { return null; } | ||
104 | } | ||
105 | |||
106 | public void AddRegion(Scene scene) | ||
107 | { | ||
108 | if (!m_Enabled) | ||
109 | return; | ||
110 | |||
111 | m_log.DebugFormat("[Groups]: Registering {0} with {1}", this.Name, scene.RegionInfo.RegionName); | ||
112 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | ||
113 | m_Scenes.Add(scene); | ||
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | if (!m_Enabled) | ||
119 | return; | ||
120 | |||
121 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | ||
122 | m_Scenes.Remove(scene); | ||
123 | } | ||
124 | |||
125 | public void RegionLoaded(Scene scene) | ||
126 | { | ||
127 | if (!m_Enabled) | ||
128 | return; | ||
129 | |||
130 | if (m_UserManagement == null) | ||
131 | { | ||
132 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | ||
133 | m_ForeignImporter = new ForeignImporter(m_UserManagement); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public void PostInitialise() | ||
138 | { | ||
139 | } | ||
140 | |||
141 | public void Close() | ||
142 | { | ||
143 | } | ||
144 | |||
145 | #endregion | ||
146 | |||
147 | #region IGroupsServicesConnector | ||
148 | |||
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) | ||
151 | { | ||
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); | ||
156 | } | ||
157 | |||
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) | ||
160 | { | ||
161 | reason = string.Empty; | ||
162 | m_GroupsService.UpdateGroup(RequestingAgentID, groupID, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish); | ||
163 | return true; | ||
164 | } | ||
165 | |||
166 | public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName) | ||
167 | { | ||
168 | if (GroupID != UUID.Zero) | ||
169 | return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID); | ||
170 | else if (GroupName != null) | ||
171 | return m_GroupsService.GetGroupRecord(RequestingAgentID, GroupName); | ||
172 | |||
173 | return null; | ||
174 | } | ||
175 | |||
176 | public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search) | ||
177 | { | ||
178 | return m_GroupsService.FindGroups(RequestingAgentID, search); | ||
179 | } | ||
180 | |||
181 | public List<GroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID) | ||
182 | { | ||
183 | List<ExtendedGroupMembersData> _members = m_GroupsService.GetGroupMembers(RequestingAgentID, GroupID); | ||
184 | if (_members != null && _members.Count > 0) | ||
185 | { | ||
186 | List<GroupMembersData> members = _members.ConvertAll<GroupMembersData>(new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData)); | ||
187 | return members; | ||
188 | } | ||
189 | |||
190 | return new List<GroupMembersData>(); | ||
191 | } | ||
192 | |||
193 | public bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason) | ||
194 | { | ||
195 | return m_GroupsService.AddGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers, out reason); | ||
196 | } | ||
197 | |||
198 | public bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers) | ||
199 | { | ||
200 | return m_GroupsService.UpdateGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers); | ||
201 | } | ||
202 | |||
203 | public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID) | ||
204 | { | ||
205 | m_GroupsService.RemoveGroupRole(RequestingAgentID, groupID, roleID); | ||
206 | } | ||
207 | |||
208 | public List<GroupRolesData> GetGroupRoles(string RequestingAgentID, UUID GroupID) | ||
209 | { | ||
210 | return m_GroupsService.GetGroupRoles(RequestingAgentID, GroupID); | ||
211 | } | ||
212 | |||
213 | public List<GroupRoleMembersData> GetGroupRoleMembers(string RequestingAgentID, UUID GroupID) | ||
214 | { | ||
215 | List<ExtendedGroupRoleMembersData> _rm = m_GroupsService.GetGroupRoleMembers(RequestingAgentID, GroupID); | ||
216 | if (_rm != null && _rm.Count > 0) | ||
217 | { | ||
218 | List<GroupRoleMembersData> rm = _rm.ConvertAll<GroupRoleMembersData>(new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData)); | ||
219 | return rm; | ||
220 | } | ||
221 | |||
222 | return new List<GroupRoleMembersData>(); | ||
223 | |||
224 | } | ||
225 | |||
226 | public bool AddAgentToGroup(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID, string token, out string reason) | ||
227 | { | ||
228 | return m_GroupsService.AddAgentToGroup(RequestingAgentID, AgentID, GroupID, RoleID, token, out reason); | ||
229 | } | ||
230 | |||
231 | public void RemoveAgentFromGroup(string RequestingAgentID, string AgentID, UUID GroupID) | ||
232 | { | ||
233 | m_GroupsService.RemoveAgentFromGroup(RequestingAgentID, AgentID, GroupID); | ||
234 | } | ||
235 | |||
236 | public bool AddAgentToGroupInvite(string RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID, string agentID) | ||
237 | { | ||
238 | return m_GroupsService.AddAgentToGroupInvite(RequestingAgentID, inviteID, groupID, roleID, agentID); | ||
239 | } | ||
240 | |||
241 | public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID) | ||
242 | { | ||
243 | return m_GroupsService.GetAgentToGroupInvite(RequestingAgentID, inviteID); ; | ||
244 | } | ||
245 | |||
246 | public void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID) | ||
247 | { | ||
248 | m_GroupsService.RemoveAgentToGroupInvite(RequestingAgentID, inviteID); | ||
249 | } | ||
250 | |||
251 | public void AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) | ||
252 | { | ||
253 | m_GroupsService.AddAgentToGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); | ||
254 | } | ||
255 | |||
256 | public void RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) | ||
257 | { | ||
258 | m_GroupsService.RemoveAgentFromGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); | ||
259 | } | ||
260 | |||
261 | public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID) | ||
262 | { | ||
263 | return m_GroupsService.GetAgentGroupRoles(RequestingAgentID, AgentID, GroupID); | ||
264 | } | ||
265 | |||
266 | public void SetAgentActiveGroup(string RequestingAgentID, string AgentID, UUID GroupID) | ||
267 | { | ||
268 | m_GroupsService.SetAgentActiveGroup(RequestingAgentID, AgentID, GroupID); | ||
269 | } | ||
270 | |||
271 | public ExtendedGroupMembershipData GetAgentActiveMembership(string RequestingAgentID, string AgentID) | ||
272 | { | ||
273 | return m_GroupsService.GetAgentActiveMembership(RequestingAgentID, AgentID); | ||
274 | } | ||
275 | |||
276 | public void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID) | ||
277 | { | ||
278 | m_GroupsService.SetAgentActiveGroupRole(RequestingAgentID, AgentID, GroupID, RoleID); | ||
279 | } | ||
280 | |||
281 | public void UpdateMembership(string RequestingAgentID, string AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | ||
282 | { | ||
283 | m_GroupsService.UpdateMembership(RequestingAgentID, AgentID, GroupID, AcceptNotices, ListInProfile); | ||
284 | } | ||
285 | |||
286 | public ExtendedGroupMembershipData GetAgentGroupMembership(string RequestingAgentID, string AgentID, UUID GroupID) | ||
287 | { | ||
288 | return m_GroupsService.GetAgentGroupMembership(RequestingAgentID, AgentID, GroupID); ; | ||
289 | } | ||
290 | |||
291 | public List<GroupMembershipData> GetAgentGroupMemberships(string RequestingAgentID, string AgentID) | ||
292 | { | ||
293 | return m_GroupsService.GetAgentGroupMemberships(RequestingAgentID, AgentID); | ||
294 | } | ||
295 | |||
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) | ||
298 | { | ||
299 | return m_GroupsService.AddGroupNotice(RequestingAgentID, groupID, noticeID, fromName, subject, message, | ||
300 | hasAttachment, attType, attName, attItemID, attOwnerID); | ||
301 | } | ||
302 | |||
303 | public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID) | ||
304 | { | ||
305 | GroupNoticeInfo notice = m_GroupsService.GetGroupNotice(RequestingAgentID, noticeID); | ||
306 | |||
307 | //if (notice != null && notice.noticeData.HasAttachment && notice.noticeData.AttachmentOwnerID != null) | ||
308 | //{ | ||
309 | // UUID userID = UUID.Zero; | ||
310 | // string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty; | ||
311 | // Util.ParseUniversalUserIdentifier(notice.noticeData.AttachmentOwnerID, out userID, out url, out first, out last, out tmp); | ||
312 | // if (url != string.Empty) | ||
313 | // m_UserManagement.AddUser(userID, first, last, url); | ||
314 | //} | ||
315 | |||
316 | return notice; | ||
317 | } | ||
318 | |||
319 | public List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID) | ||
320 | { | ||
321 | return m_GroupsService.GetGroupNotices(RequestingAgentID, GroupID); | ||
322 | } | ||
323 | |||
324 | #endregion | ||
325 | } | ||
326 | } | ||