diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 209 |
1 files changed, 126 insertions, 83 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 964d0bb..ab343c8 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -40,16 +40,16 @@ using OpenMetaverse; | |||
40 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
41 | 41 | ||
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Framework.Communications; | ||
43 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
45 | using OpenSim.Services.Interfaces; | ||
44 | 46 | ||
45 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | 47 | namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups |
46 | { | 48 | { |
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
48 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector | 50 | public class XmlRpcGroupsServicesConnectorModule : ISharedRegionModule, IGroupsServicesConnector |
49 | { | 51 | { |
50 | private static readonly ILog m_log = | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | 53 | ||
54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | | 54 | public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | |
55 | GroupPowers.Accountable | | 55 | GroupPowers.Accountable | |
@@ -68,6 +68,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
68 | private string m_groupReadKey = string.Empty; | 68 | private string m_groupReadKey = string.Empty; |
69 | private string m_groupWriteKey = string.Empty; | 69 | private string m_groupWriteKey = string.Empty; |
70 | 70 | ||
71 | private IUserAccountService m_accountService = null; | ||
72 | |||
71 | 73 | ||
72 | #region IRegionModuleBase Members | 74 | #region IRegionModuleBase Members |
73 | 75 | ||
@@ -118,6 +120,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
118 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 120 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
119 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 121 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
120 | 122 | ||
123 | |||
124 | |||
125 | |||
121 | // If we got all the config options we need, lets start'er'up | 126 | // If we got all the config options we need, lets start'er'up |
122 | m_connectorEnabled = true; | 127 | m_connectorEnabled = true; |
123 | } | 128 | } |
@@ -131,13 +136,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
131 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 136 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
132 | { | 137 | { |
133 | if (m_connectorEnabled) | 138 | if (m_connectorEnabled) |
139 | { | ||
140 | |||
141 | if (m_accountService == null) | ||
142 | { | ||
143 | m_accountService = scene.UserAccountService; | ||
144 | } | ||
145 | |||
146 | |||
134 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 147 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
148 | } | ||
135 | } | 149 | } |
136 | 150 | ||
137 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 151 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
138 | { | 152 | { |
139 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 153 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
154 | { | ||
140 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 155 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
156 | } | ||
141 | } | 157 | } |
142 | 158 | ||
143 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 159 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -157,14 +173,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
157 | 173 | ||
158 | #endregion | 174 | #endregion |
159 | 175 | ||
160 | |||
161 | |||
162 | #region IGroupsServicesConnector Members | 176 | #region IGroupsServicesConnector Members |
163 | 177 | ||
164 | /// <summary> | 178 | /// <summary> |
165 | /// 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. | 179 | /// 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. |
166 | /// </summary> | 180 | /// </summary> |
167 | public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID, | 181 | public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, |
168 | int membershipFee, bool openEnrollment, bool allowPublish, | 182 | int membershipFee, bool openEnrollment, bool allowPublish, |
169 | bool maturePublish, UUID founderID) | 183 | bool maturePublish, UUID founderID) |
170 | { | 184 | { |
@@ -236,7 +250,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
236 | 250 | ||
237 | 251 | ||
238 | 252 | ||
239 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 253 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
240 | 254 | ||
241 | if (respData.Contains("error")) | 255 | if (respData.Contains("error")) |
242 | { | 256 | { |
@@ -248,7 +262,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
248 | return UUID.Parse((string)respData["GroupID"]); | 262 | return UUID.Parse((string)respData["GroupID"]); |
249 | } | 263 | } |
250 | 264 | ||
251 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 265 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
252 | UUID insigniaID, int membershipFee, bool openEnrollment, | 266 | UUID insigniaID, int membershipFee, bool openEnrollment, |
253 | bool allowPublish, bool maturePublish) | 267 | bool allowPublish, bool maturePublish) |
254 | { | 268 | { |
@@ -262,10 +276,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
262 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 276 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
263 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 277 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
264 | 278 | ||
265 | XmlRpcCall(requestID, "groups.updateGroup", param); | 279 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
266 | } | 280 | } |
267 | 281 | ||
268 | public void AddGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 282 | public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
269 | string title, ulong powers) | 283 | string title, ulong powers) |
270 | { | 284 | { |
271 | Hashtable param = new Hashtable(); | 285 | Hashtable param = new Hashtable(); |
@@ -276,19 +290,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
276 | param["Title"] = title; | 290 | param["Title"] = title; |
277 | param["Powers"] = powers.ToString(); | 291 | param["Powers"] = powers.ToString(); |
278 | 292 | ||
279 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 293 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
280 | } | 294 | } |
281 | 295 | ||
282 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 296 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
283 | { | 297 | { |
284 | Hashtable param = new Hashtable(); | 298 | Hashtable param = new Hashtable(); |
285 | param["GroupID"] = groupID.ToString(); | 299 | param["GroupID"] = groupID.ToString(); |
286 | param["RoleID"] = roleID.ToString(); | 300 | param["RoleID"] = roleID.ToString(); |
287 | 301 | ||
288 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 302 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
289 | } | 303 | } |
290 | 304 | ||
291 | public void UpdateGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID, string name, string description, | 305 | public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, |
292 | string title, ulong powers) | 306 | string title, ulong powers) |
293 | { | 307 | { |
294 | Hashtable param = new Hashtable(); | 308 | Hashtable param = new Hashtable(); |
@@ -308,10 +322,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
308 | } | 322 | } |
309 | param["Powers"] = powers.ToString(); | 323 | param["Powers"] = powers.ToString(); |
310 | 324 | ||
311 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 325 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
312 | } | 326 | } |
313 | 327 | ||
314 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 328 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
315 | { | 329 | { |
316 | Hashtable param = new Hashtable(); | 330 | Hashtable param = new Hashtable(); |
317 | if (GroupID != UUID.Zero) | 331 | if (GroupID != UUID.Zero) |
@@ -323,7 +337,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
323 | param["Name"] = GroupName.ToString(); | 337 | param["Name"] = GroupName.ToString(); |
324 | } | 338 | } |
325 | 339 | ||
326 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 340 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
327 | 341 | ||
328 | if (respData.Contains("error")) | 342 | if (respData.Contains("error")) |
329 | { | 343 | { |
@@ -334,12 +348,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
334 | 348 | ||
335 | } | 349 | } |
336 | 350 | ||
337 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 351 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
338 | { | 352 | { |
339 | Hashtable param = new Hashtable(); | 353 | Hashtable param = new Hashtable(); |
340 | param["GroupID"] = GroupID.ToString(); | 354 | param["GroupID"] = GroupID.ToString(); |
341 | 355 | ||
342 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 356 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
343 | 357 | ||
344 | if (respData.Contains("error")) | 358 | if (respData.Contains("error")) |
345 | { | 359 | { |
@@ -347,38 +361,35 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
347 | return new GroupProfileData(); | 361 | return new GroupProfileData(); |
348 | } | 362 | } |
349 | 363 | ||
350 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 364 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
351 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 365 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
352 | 366 | ||
353 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 367 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
354 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; | 368 | MemberGroupProfile.PowersMask = MemberInfo.GroupPowers; |
355 | 369 | ||
356 | return MemberGroupProfile; | 370 | return MemberGroupProfile; |
357 | |||
358 | } | 371 | } |
359 | 372 | ||
360 | 373 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | |
361 | |||
362 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | ||
363 | { | 374 | { |
364 | Hashtable param = new Hashtable(); | 375 | Hashtable param = new Hashtable(); |
365 | param["AgentID"] = AgentID.ToString(); | 376 | param["AgentID"] = AgentID.ToString(); |
366 | param["GroupID"] = GroupID.ToString(); | 377 | param["GroupID"] = GroupID.ToString(); |
367 | 378 | ||
368 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 379 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
369 | } | 380 | } |
370 | 381 | ||
371 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 382 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
372 | { | 383 | { |
373 | Hashtable param = new Hashtable(); | 384 | Hashtable param = new Hashtable(); |
374 | param["AgentID"] = AgentID.ToString(); | 385 | param["AgentID"] = AgentID.ToString(); |
375 | param["GroupID"] = GroupID.ToString(); | 386 | param["GroupID"] = GroupID.ToString(); |
376 | param["SelectedRoleID"] = RoleID.ToString(); | 387 | param["SelectedRoleID"] = RoleID.ToString(); |
377 | 388 | ||
378 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 389 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
379 | } | 390 | } |
380 | 391 | ||
381 | public void SetAgentGroupInfo(GroupRequestID requestID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 392 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) |
382 | { | 393 | { |
383 | Hashtable param = new Hashtable(); | 394 | Hashtable param = new Hashtable(); |
384 | param["AgentID"] = AgentID.ToString(); | 395 | param["AgentID"] = AgentID.ToString(); |
@@ -386,11 +397,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
386 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 397 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
387 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 398 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
388 | 399 | ||
389 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 400 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
390 | 401 | ||
391 | } | 402 | } |
392 | 403 | ||
393 | public void AddAgentToGroupInvite(GroupRequestID requestID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 404 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
394 | { | 405 | { |
395 | Hashtable param = new Hashtable(); | 406 | Hashtable param = new Hashtable(); |
396 | param["InviteID"] = inviteID.ToString(); | 407 | param["InviteID"] = inviteID.ToString(); |
@@ -398,16 +409,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
398 | param["RoleID"] = roleID.ToString(); | 409 | param["RoleID"] = roleID.ToString(); |
399 | param["GroupID"] = groupID.ToString(); | 410 | param["GroupID"] = groupID.ToString(); |
400 | 411 | ||
401 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 412 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
402 | 413 | ||
403 | } | 414 | } |
404 | 415 | ||
405 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 416 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
406 | { | 417 | { |
407 | Hashtable param = new Hashtable(); | 418 | Hashtable param = new Hashtable(); |
408 | param["InviteID"] = inviteID.ToString(); | 419 | param["InviteID"] = inviteID.ToString(); |
409 | 420 | ||
410 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 421 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
411 | 422 | ||
412 | if (respData.Contains("error")) | 423 | if (respData.Contains("error")) |
413 | { | 424 | { |
@@ -423,60 +434,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
423 | return inviteInfo; | 434 | return inviteInfo; |
424 | } | 435 | } |
425 | 436 | ||
426 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 437 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
427 | { | 438 | { |
428 | Hashtable param = new Hashtable(); | 439 | Hashtable param = new Hashtable(); |
429 | param["InviteID"] = inviteID.ToString(); | 440 | param["InviteID"] = inviteID.ToString(); |
430 | 441 | ||
431 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 442 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
432 | } | 443 | } |
433 | 444 | ||
434 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 445 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
435 | { | 446 | { |
436 | Hashtable param = new Hashtable(); | 447 | Hashtable param = new Hashtable(); |
437 | param["AgentID"] = AgentID.ToString(); | 448 | param["AgentID"] = AgentID.ToString(); |
438 | param["GroupID"] = GroupID.ToString(); | 449 | param["GroupID"] = GroupID.ToString(); |
439 | param["RoleID"] = RoleID.ToString(); | 450 | param["RoleID"] = RoleID.ToString(); |
440 | 451 | ||
441 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 452 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
442 | } | 453 | } |
443 | 454 | ||
444 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 455 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
445 | { | 456 | { |
446 | Hashtable param = new Hashtable(); | 457 | Hashtable param = new Hashtable(); |
447 | param["AgentID"] = AgentID.ToString(); | 458 | param["AgentID"] = AgentID.ToString(); |
448 | param["GroupID"] = GroupID.ToString(); | 459 | param["GroupID"] = GroupID.ToString(); |
449 | 460 | ||
450 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 461 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
451 | } | 462 | } |
452 | 463 | ||
453 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 464 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
454 | { | 465 | { |
455 | Hashtable param = new Hashtable(); | 466 | Hashtable param = new Hashtable(); |
456 | param["AgentID"] = AgentID.ToString(); | 467 | param["AgentID"] = AgentID.ToString(); |
457 | param["GroupID"] = GroupID.ToString(); | 468 | param["GroupID"] = GroupID.ToString(); |
458 | param["RoleID"] = RoleID.ToString(); | 469 | param["RoleID"] = RoleID.ToString(); |
459 | 470 | ||
460 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 471 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
461 | } | 472 | } |
462 | 473 | ||
463 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 474 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
464 | { | 475 | { |
465 | Hashtable param = new Hashtable(); | 476 | Hashtable param = new Hashtable(); |
466 | param["AgentID"] = AgentID.ToString(); | 477 | param["AgentID"] = AgentID.ToString(); |
467 | param["GroupID"] = GroupID.ToString(); | 478 | param["GroupID"] = GroupID.ToString(); |
468 | param["RoleID"] = RoleID.ToString(); | 479 | param["RoleID"] = RoleID.ToString(); |
469 | 480 | ||
470 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 481 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
471 | } | 482 | } |
472 | 483 | ||
473 | 484 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) | |
474 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | ||
475 | { | 485 | { |
476 | Hashtable param = new Hashtable(); | 486 | Hashtable param = new Hashtable(); |
477 | param["Search"] = search; | 487 | param["Search"] = search; |
478 | 488 | ||
479 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 489 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
480 | 490 | ||
481 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 491 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
482 | 492 | ||
@@ -498,13 +508,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
498 | return findings; | 508 | return findings; |
499 | } | 509 | } |
500 | 510 | ||
501 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 511 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
502 | { | 512 | { |
503 | Hashtable param = new Hashtable(); | 513 | Hashtable param = new Hashtable(); |
504 | param["AgentID"] = AgentID.ToString(); | 514 | param["AgentID"] = AgentID.ToString(); |
505 | param["GroupID"] = GroupID.ToString(); | 515 | param["GroupID"] = GroupID.ToString(); |
506 | 516 | ||
507 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 517 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
508 | 518 | ||
509 | if (respData.Contains("error")) | 519 | if (respData.Contains("error")) |
510 | { | 520 | { |
@@ -516,12 +526,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
516 | return data; | 526 | return data; |
517 | } | 527 | } |
518 | 528 | ||
519 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 529 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
520 | { | 530 | { |
521 | Hashtable param = new Hashtable(); | 531 | Hashtable param = new Hashtable(); |
522 | param["AgentID"] = AgentID.ToString(); | 532 | param["AgentID"] = AgentID.ToString(); |
523 | 533 | ||
524 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 534 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
525 | 535 | ||
526 | if (respData.Contains("error")) | 536 | if (respData.Contains("error")) |
527 | { | 537 | { |
@@ -531,13 +541,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
531 | return HashTableToGroupMembershipData(respData); | 541 | return HashTableToGroupMembershipData(respData); |
532 | } | 542 | } |
533 | 543 | ||
534 | 544 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) | |
535 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | ||
536 | { | 545 | { |
537 | Hashtable param = new Hashtable(); | 546 | Hashtable param = new Hashtable(); |
538 | param["AgentID"] = AgentID.ToString(); | 547 | param["AgentID"] = AgentID.ToString(); |
539 | 548 | ||
540 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 549 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
541 | 550 | ||
542 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 551 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
543 | 552 | ||
@@ -552,13 +561,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
552 | return memberships; | 561 | return memberships; |
553 | } | 562 | } |
554 | 563 | ||
555 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 564 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
556 | { | 565 | { |
557 | Hashtable param = new Hashtable(); | 566 | Hashtable param = new Hashtable(); |
558 | param["AgentID"] = AgentID.ToString(); | 567 | param["AgentID"] = AgentID.ToString(); |
559 | param["GroupID"] = GroupID.ToString(); | 568 | param["GroupID"] = GroupID.ToString(); |
560 | 569 | ||
561 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 570 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
562 | 571 | ||
563 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 572 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
564 | 573 | ||
@@ -584,12 +593,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
584 | 593 | ||
585 | } | 594 | } |
586 | 595 | ||
587 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 596 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
588 | { | 597 | { |
589 | Hashtable param = new Hashtable(); | 598 | Hashtable param = new Hashtable(); |
590 | param["GroupID"] = GroupID.ToString(); | 599 | param["GroupID"] = GroupID.ToString(); |
591 | 600 | ||
592 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 601 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
593 | 602 | ||
594 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 603 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
595 | 604 | ||
@@ -617,12 +626,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
617 | 626 | ||
618 | 627 | ||
619 | 628 | ||
620 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 629 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
621 | { | 630 | { |
622 | Hashtable param = new Hashtable(); | 631 | Hashtable param = new Hashtable(); |
623 | param["GroupID"] = GroupID.ToString(); | 632 | param["GroupID"] = GroupID.ToString(); |
624 | 633 | ||
625 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 634 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
626 | 635 | ||
627 | List<GroupMembersData> members = new List<GroupMembersData>(); | 636 | List<GroupMembersData> members = new List<GroupMembersData>(); |
628 | 637 | ||
@@ -650,12 +659,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
650 | 659 | ||
651 | } | 660 | } |
652 | 661 | ||
653 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 662 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
654 | { | 663 | { |
655 | Hashtable param = new Hashtable(); | 664 | Hashtable param = new Hashtable(); |
656 | param["GroupID"] = GroupID.ToString(); | 665 | param["GroupID"] = GroupID.ToString(); |
657 | 666 | ||
658 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 667 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
659 | 668 | ||
660 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 669 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
661 | 670 | ||
@@ -674,12 +683,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
674 | return members; | 683 | return members; |
675 | } | 684 | } |
676 | 685 | ||
677 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 686 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
678 | { | 687 | { |
679 | Hashtable param = new Hashtable(); | 688 | Hashtable param = new Hashtable(); |
680 | param["GroupID"] = GroupID.ToString(); | 689 | param["GroupID"] = GroupID.ToString(); |
681 | 690 | ||
682 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 691 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
683 | 692 | ||
684 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 693 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
685 | 694 | ||
@@ -701,12 +710,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
701 | return values; | 710 | return values; |
702 | 711 | ||
703 | } | 712 | } |
704 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 713 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
705 | { | 714 | { |
706 | Hashtable param = new Hashtable(); | 715 | Hashtable param = new Hashtable(); |
707 | param["NoticeID"] = noticeID.ToString(); | 716 | param["NoticeID"] = noticeID.ToString(); |
708 | 717 | ||
709 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 718 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
710 | 719 | ||
711 | 720 | ||
712 | if (respData.Contains("error")) | 721 | if (respData.Contains("error")) |
@@ -732,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
732 | 741 | ||
733 | return data; | 742 | return data; |
734 | } | 743 | } |
735 | public void AddGroupNotice(GroupRequestID requestID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 744 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
736 | { | 745 | { |
737 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 746 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
738 | 747 | ||
@@ -745,7 +754,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
745 | param["BinaryBucket"] = binBucket; | 754 | param["BinaryBucket"] = binBucket; |
746 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 755 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
747 | 756 | ||
748 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 757 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
749 | } | 758 | } |
750 | #endregion | 759 | #endregion |
751 | 760 | ||
@@ -778,7 +787,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
778 | 787 | ||
779 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) | 788 | private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile) |
780 | { | 789 | { |
781 | |||
782 | GroupRecord group = new GroupRecord(); | 790 | GroupRecord group = new GroupRecord(); |
783 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); | 791 | group.GroupID = UUID.Parse((string)groupProfile["GroupID"]); |
784 | group.GroupName = groupProfile["Name"].ToString(); | 792 | group.GroupName = groupProfile["Name"].ToString(); |
@@ -797,6 +805,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
797 | 805 | ||
798 | return group; | 806 | return group; |
799 | } | 807 | } |
808 | |||
800 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) | 809 | private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) |
801 | { | 810 | { |
802 | GroupMembershipData data = new GroupMembershipData(); | 811 | GroupMembershipData data = new GroupMembershipData(); |
@@ -829,6 +838,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
829 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); | 838 | data.MembershipFee = int.Parse((string)respData["MembershipFee"]); |
830 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); | 839 | data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); |
831 | data.ShowInList = ((string)respData["ShowInList"] == "1"); | 840 | data.ShowInList = ((string)respData["ShowInList"] == "1"); |
841 | |||
832 | return data; | 842 | return data; |
833 | } | 843 | } |
834 | 844 | ||
@@ -837,15 +847,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
837 | /// <summary> | 847 | /// <summary> |
838 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 848 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
839 | /// </summary> | 849 | /// </summary> |
840 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 850 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
841 | { | 851 | { |
842 | if (requestID == null) | 852 | string UserService; |
843 | { | 853 | UUID SessionID; |
844 | requestID = new GroupRequestID(); | 854 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
845 | } | 855 | param.Add("requestingAgentID", requestingAgentID.ToString()); |
846 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | 856 | param.Add("RequestingAgentUserService", UserService); |
847 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | 857 | param.Add("RequestingSessionID", SessionID.ToString()); |
848 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
849 | 858 | ||
850 | 859 | ||
851 | param.Add("ReadKey", m_groupReadKey); | 860 | param.Add("ReadKey", m_groupReadKey); |
@@ -936,15 +945,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
936 | } | 945 | } |
937 | } | 946 | } |
938 | 947 | ||
948 | |||
949 | /// <summary> | ||
950 | /// Group Request Tokens are an attempt to allow the groups service to authenticate | ||
951 | /// requests. Currently uses UserService, AgentID, and SessionID | ||
952 | /// TODO: Find a better way to do this. | ||
953 | /// </summary> | ||
954 | /// <param name="client"></param> | ||
955 | /// <returns></returns> | ||
956 | private void GetClientGroupRequestID(UUID AgentID, out string UserServiceURL, out UUID SessionID) | ||
957 | { | ||
958 | UserServiceURL = ""; | ||
959 | SessionID = UUID.Zero; | ||
939 | 960 | ||
940 | } | ||
941 | 961 | ||
942 | public class GroupNoticeInfo | 962 | // Need to rework this based on changes to User Services |
943 | { | 963 | /* |
944 | public GroupNoticeData noticeData = new GroupNoticeData(); | 964 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); |
945 | public UUID GroupID = UUID.Zero; | 965 | if (userAccount == null) |
946 | public string Message = string.Empty; | 966 | { |
947 | public byte[] BinaryBucket = new byte[0]; | 967 | // This should be impossible. If I've been passed a reference to a client |
968 | // that client should be registered with the UserService. So something | ||
969 | // is horribly wrong somewhere. | ||
970 | |||
971 | m_log.WarnFormat("[GROUPS]: Could not find a UserServiceURL for {0}", AgentID); | ||
972 | |||
973 | } | ||
974 | else if (userProfile is ForeignUserProfileData) | ||
975 | { | ||
976 | // They aren't from around here | ||
977 | ForeignUserProfileData fupd = (ForeignUserProfileData)userProfile; | ||
978 | UserServiceURL = fupd.UserServerURI; | ||
979 | SessionID = fupd.CurrentAgent.SessionID; | ||
980 | |||
981 | } | ||
982 | else | ||
983 | { | ||
984 | // They're a local user, use this: | ||
985 | UserServiceURL = m_commManager.NetworkServersInfo.UserURL; | ||
986 | SessionID = userProfile.CurrentAgent.SessionID; | ||
987 | } | ||
988 | */ | ||
989 | } | ||
990 | |||
948 | } | 991 | } |
949 | } | 992 | } |
950 | 993 | ||