diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 197 |
1 files changed, 123 insertions, 74 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 24ae4f7..ab343c8 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | |||
@@ -40,7 +40,9 @@ 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 | { |
@@ -66,6 +68,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
66 | private string m_groupReadKey = string.Empty; | 68 | private string m_groupReadKey = string.Empty; |
67 | private string m_groupWriteKey = string.Empty; | 69 | private string m_groupWriteKey = string.Empty; |
68 | 70 | ||
71 | private IUserAccountService m_accountService = null; | ||
72 | |||
69 | 73 | ||
70 | #region IRegionModuleBase Members | 74 | #region IRegionModuleBase Members |
71 | 75 | ||
@@ -116,6 +120,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
116 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); | 120 | m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); |
117 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); | 121 | m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); |
118 | 122 | ||
123 | |||
124 | |||
125 | |||
119 | // 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 |
120 | m_connectorEnabled = true; | 127 | m_connectorEnabled = true; |
121 | } | 128 | } |
@@ -129,13 +136,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
129 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 136 | public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
130 | { | 137 | { |
131 | if (m_connectorEnabled) | 138 | if (m_connectorEnabled) |
139 | { | ||
140 | |||
141 | if (m_accountService == null) | ||
142 | { | ||
143 | m_accountService = scene.UserAccountService; | ||
144 | } | ||
145 | |||
146 | |||
132 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); | 147 | scene.RegisterModuleInterface<IGroupsServicesConnector>(this); |
148 | } | ||
133 | } | 149 | } |
134 | 150 | ||
135 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) | 151 | public void RemoveRegion(OpenSim.Region.Framework.Scenes.Scene scene) |
136 | { | 152 | { |
137 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) | 153 | if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this) |
154 | { | ||
138 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); | 155 | scene.UnregisterModuleInterface<IGroupsServicesConnector>(this); |
156 | } | ||
139 | } | 157 | } |
140 | 158 | ||
141 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) | 159 | public void RegionLoaded(OpenSim.Region.Framework.Scenes.Scene scene) |
@@ -155,14 +173,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
155 | 173 | ||
156 | #endregion | 174 | #endregion |
157 | 175 | ||
158 | |||
159 | |||
160 | #region IGroupsServicesConnector Members | 176 | #region IGroupsServicesConnector Members |
161 | 177 | ||
162 | /// <summary> | 178 | /// <summary> |
163 | /// 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. |
164 | /// </summary> | 180 | /// </summary> |
165 | 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, |
166 | int membershipFee, bool openEnrollment, bool allowPublish, | 182 | int membershipFee, bool openEnrollment, bool allowPublish, |
167 | bool maturePublish, UUID founderID) | 183 | bool maturePublish, UUID founderID) |
168 | { | 184 | { |
@@ -234,7 +250,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
234 | 250 | ||
235 | 251 | ||
236 | 252 | ||
237 | Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param); | 253 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param); |
238 | 254 | ||
239 | if (respData.Contains("error")) | 255 | if (respData.Contains("error")) |
240 | { | 256 | { |
@@ -246,7 +262,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
246 | return UUID.Parse((string)respData["GroupID"]); | 262 | return UUID.Parse((string)respData["GroupID"]); |
247 | } | 263 | } |
248 | 264 | ||
249 | public void UpdateGroup(GroupRequestID requestID, UUID groupID, string charter, bool showInList, | 265 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
250 | UUID insigniaID, int membershipFee, bool openEnrollment, | 266 | UUID insigniaID, int membershipFee, bool openEnrollment, |
251 | bool allowPublish, bool maturePublish) | 267 | bool allowPublish, bool maturePublish) |
252 | { | 268 | { |
@@ -260,10 +276,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
260 | param["AllowPublish"] = allowPublish == true ? 1 : 0; | 276 | param["AllowPublish"] = allowPublish == true ? 1 : 0; |
261 | param["MaturePublish"] = maturePublish == true ? 1 : 0; | 277 | param["MaturePublish"] = maturePublish == true ? 1 : 0; |
262 | 278 | ||
263 | XmlRpcCall(requestID, "groups.updateGroup", param); | 279 | XmlRpcCall(requestingAgentID, "groups.updateGroup", param); |
264 | } | 280 | } |
265 | 281 | ||
266 | 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, |
267 | string title, ulong powers) | 283 | string title, ulong powers) |
268 | { | 284 | { |
269 | Hashtable param = new Hashtable(); | 285 | Hashtable param = new Hashtable(); |
@@ -274,19 +290,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
274 | param["Title"] = title; | 290 | param["Title"] = title; |
275 | param["Powers"] = powers.ToString(); | 291 | param["Powers"] = powers.ToString(); |
276 | 292 | ||
277 | XmlRpcCall(requestID, "groups.addRoleToGroup", param); | 293 | XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param); |
278 | } | 294 | } |
279 | 295 | ||
280 | public void RemoveGroupRole(GroupRequestID requestID, UUID groupID, UUID roleID) | 296 | public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID) |
281 | { | 297 | { |
282 | Hashtable param = new Hashtable(); | 298 | Hashtable param = new Hashtable(); |
283 | param["GroupID"] = groupID.ToString(); | 299 | param["GroupID"] = groupID.ToString(); |
284 | param["RoleID"] = roleID.ToString(); | 300 | param["RoleID"] = roleID.ToString(); |
285 | 301 | ||
286 | XmlRpcCall(requestID, "groups.removeRoleFromGroup", param); | 302 | XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); |
287 | } | 303 | } |
288 | 304 | ||
289 | 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, |
290 | string title, ulong powers) | 306 | string title, ulong powers) |
291 | { | 307 | { |
292 | Hashtable param = new Hashtable(); | 308 | Hashtable param = new Hashtable(); |
@@ -306,10 +322,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
306 | } | 322 | } |
307 | param["Powers"] = powers.ToString(); | 323 | param["Powers"] = powers.ToString(); |
308 | 324 | ||
309 | XmlRpcCall(requestID, "groups.updateGroupRole", param); | 325 | XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param); |
310 | } | 326 | } |
311 | 327 | ||
312 | public GroupRecord GetGroupRecord(GroupRequestID requestID, UUID GroupID, string GroupName) | 328 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) |
313 | { | 329 | { |
314 | Hashtable param = new Hashtable(); | 330 | Hashtable param = new Hashtable(); |
315 | if (GroupID != UUID.Zero) | 331 | if (GroupID != UUID.Zero) |
@@ -321,7 +337,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
321 | param["Name"] = GroupName.ToString(); | 337 | param["Name"] = GroupName.ToString(); |
322 | } | 338 | } |
323 | 339 | ||
324 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 340 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
325 | 341 | ||
326 | if (respData.Contains("error")) | 342 | if (respData.Contains("error")) |
327 | { | 343 | { |
@@ -332,12 +348,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
332 | 348 | ||
333 | } | 349 | } |
334 | 350 | ||
335 | public GroupProfileData GetMemberGroupProfile(GroupRequestID requestID, UUID GroupID, UUID AgentID) | 351 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |
336 | { | 352 | { |
337 | Hashtable param = new Hashtable(); | 353 | Hashtable param = new Hashtable(); |
338 | param["GroupID"] = GroupID.ToString(); | 354 | param["GroupID"] = GroupID.ToString(); |
339 | 355 | ||
340 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroup", param); | 356 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param); |
341 | 357 | ||
342 | if (respData.Contains("error")) | 358 | if (respData.Contains("error")) |
343 | { | 359 | { |
@@ -345,7 +361,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
345 | return new GroupProfileData(); | 361 | return new GroupProfileData(); |
346 | } | 362 | } |
347 | 363 | ||
348 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestID, AgentID, GroupID); | 364 | GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID); |
349 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); | 365 | GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData); |
350 | 366 | ||
351 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; | 367 | MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle; |
@@ -354,26 +370,26 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
354 | return MemberGroupProfile; | 370 | return MemberGroupProfile; |
355 | } | 371 | } |
356 | 372 | ||
357 | public void SetAgentActiveGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 373 | public void SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
358 | { | 374 | { |
359 | Hashtable param = new Hashtable(); | 375 | Hashtable param = new Hashtable(); |
360 | param["AgentID"] = AgentID.ToString(); | 376 | param["AgentID"] = AgentID.ToString(); |
361 | param["GroupID"] = GroupID.ToString(); | 377 | param["GroupID"] = GroupID.ToString(); |
362 | 378 | ||
363 | XmlRpcCall(requestID, "groups.setAgentActiveGroup", param); | 379 | XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param); |
364 | } | 380 | } |
365 | 381 | ||
366 | public void SetAgentActiveGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 382 | public void SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
367 | { | 383 | { |
368 | Hashtable param = new Hashtable(); | 384 | Hashtable param = new Hashtable(); |
369 | param["AgentID"] = AgentID.ToString(); | 385 | param["AgentID"] = AgentID.ToString(); |
370 | param["GroupID"] = GroupID.ToString(); | 386 | param["GroupID"] = GroupID.ToString(); |
371 | param["SelectedRoleID"] = RoleID.ToString(); | 387 | param["SelectedRoleID"] = RoleID.ToString(); |
372 | 388 | ||
373 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 389 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
374 | } | 390 | } |
375 | 391 | ||
376 | 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) |
377 | { | 393 | { |
378 | Hashtable param = new Hashtable(); | 394 | Hashtable param = new Hashtable(); |
379 | param["AgentID"] = AgentID.ToString(); | 395 | param["AgentID"] = AgentID.ToString(); |
@@ -381,11 +397,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
381 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; | 397 | param["AcceptNotices"] = AcceptNotices ? "1" : "0"; |
382 | param["ListInProfile"] = ListInProfile ? "1" : "0"; | 398 | param["ListInProfile"] = ListInProfile ? "1" : "0"; |
383 | 399 | ||
384 | XmlRpcCall(requestID, "groups.setAgentGroupInfo", param); | 400 | XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param); |
385 | 401 | ||
386 | } | 402 | } |
387 | 403 | ||
388 | 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) |
389 | { | 405 | { |
390 | Hashtable param = new Hashtable(); | 406 | Hashtable param = new Hashtable(); |
391 | param["InviteID"] = inviteID.ToString(); | 407 | param["InviteID"] = inviteID.ToString(); |
@@ -393,16 +409,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
393 | param["RoleID"] = roleID.ToString(); | 409 | param["RoleID"] = roleID.ToString(); |
394 | param["GroupID"] = groupID.ToString(); | 410 | param["GroupID"] = groupID.ToString(); |
395 | 411 | ||
396 | XmlRpcCall(requestID, "groups.addAgentToGroupInvite", param); | 412 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param); |
397 | 413 | ||
398 | } | 414 | } |
399 | 415 | ||
400 | public GroupInviteInfo GetAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 416 | public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
401 | { | 417 | { |
402 | Hashtable param = new Hashtable(); | 418 | Hashtable param = new Hashtable(); |
403 | param["InviteID"] = inviteID.ToString(); | 419 | param["InviteID"] = inviteID.ToString(); |
404 | 420 | ||
405 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentToGroupInvite", param); | 421 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param); |
406 | 422 | ||
407 | if (respData.Contains("error")) | 423 | if (respData.Contains("error")) |
408 | { | 424 | { |
@@ -418,59 +434,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
418 | return inviteInfo; | 434 | return inviteInfo; |
419 | } | 435 | } |
420 | 436 | ||
421 | public void RemoveAgentToGroupInvite(GroupRequestID requestID, UUID inviteID) | 437 | public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID) |
422 | { | 438 | { |
423 | Hashtable param = new Hashtable(); | 439 | Hashtable param = new Hashtable(); |
424 | param["InviteID"] = inviteID.ToString(); | 440 | param["InviteID"] = inviteID.ToString(); |
425 | 441 | ||
426 | XmlRpcCall(requestID, "groups.removeAgentToGroupInvite", param); | 442 | XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param); |
427 | } | 443 | } |
428 | 444 | ||
429 | public void AddAgentToGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 445 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
430 | { | 446 | { |
431 | Hashtable param = new Hashtable(); | 447 | Hashtable param = new Hashtable(); |
432 | param["AgentID"] = AgentID.ToString(); | 448 | param["AgentID"] = AgentID.ToString(); |
433 | param["GroupID"] = GroupID.ToString(); | 449 | param["GroupID"] = GroupID.ToString(); |
434 | param["RoleID"] = RoleID.ToString(); | 450 | param["RoleID"] = RoleID.ToString(); |
435 | 451 | ||
436 | XmlRpcCall(requestID, "groups.addAgentToGroup", param); | 452 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param); |
437 | } | 453 | } |
438 | 454 | ||
439 | public void RemoveAgentFromGroup(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 455 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
440 | { | 456 | { |
441 | Hashtable param = new Hashtable(); | 457 | Hashtable param = new Hashtable(); |
442 | param["AgentID"] = AgentID.ToString(); | 458 | param["AgentID"] = AgentID.ToString(); |
443 | param["GroupID"] = GroupID.ToString(); | 459 | param["GroupID"] = GroupID.ToString(); |
444 | 460 | ||
445 | XmlRpcCall(requestID, "groups.removeAgentFromGroup", param); | 461 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param); |
446 | } | 462 | } |
447 | 463 | ||
448 | public void AddAgentToGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 464 | public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
449 | { | 465 | { |
450 | Hashtable param = new Hashtable(); | 466 | Hashtable param = new Hashtable(); |
451 | param["AgentID"] = AgentID.ToString(); | 467 | param["AgentID"] = AgentID.ToString(); |
452 | param["GroupID"] = GroupID.ToString(); | 468 | param["GroupID"] = GroupID.ToString(); |
453 | param["RoleID"] = RoleID.ToString(); | 469 | param["RoleID"] = RoleID.ToString(); |
454 | 470 | ||
455 | XmlRpcCall(requestID, "groups.addAgentToGroupRole", param); | 471 | XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param); |
456 | } | 472 | } |
457 | 473 | ||
458 | public void RemoveAgentFromGroupRole(GroupRequestID requestID, UUID AgentID, UUID GroupID, UUID RoleID) | 474 | public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) |
459 | { | 475 | { |
460 | Hashtable param = new Hashtable(); | 476 | Hashtable param = new Hashtable(); |
461 | param["AgentID"] = AgentID.ToString(); | 477 | param["AgentID"] = AgentID.ToString(); |
462 | param["GroupID"] = GroupID.ToString(); | 478 | param["GroupID"] = GroupID.ToString(); |
463 | param["RoleID"] = RoleID.ToString(); | 479 | param["RoleID"] = RoleID.ToString(); |
464 | 480 | ||
465 | XmlRpcCall(requestID, "groups.removeAgentFromGroupRole", param); | 481 | XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param); |
466 | } | 482 | } |
467 | 483 | ||
468 | public List<DirGroupsReplyData> FindGroups(GroupRequestID requestID, string search) | 484 | public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search) |
469 | { | 485 | { |
470 | Hashtable param = new Hashtable(); | 486 | Hashtable param = new Hashtable(); |
471 | param["Search"] = search; | 487 | param["Search"] = search; |
472 | 488 | ||
473 | Hashtable respData = XmlRpcCall(requestID, "groups.findGroups", param); | 489 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param); |
474 | 490 | ||
475 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); | 491 | List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>(); |
476 | 492 | ||
@@ -492,13 +508,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
492 | return findings; | 508 | return findings; |
493 | } | 509 | } |
494 | 510 | ||
495 | public GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 511 | public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
496 | { | 512 | { |
497 | Hashtable param = new Hashtable(); | 513 | Hashtable param = new Hashtable(); |
498 | param["AgentID"] = AgentID.ToString(); | 514 | param["AgentID"] = AgentID.ToString(); |
499 | param["GroupID"] = GroupID.ToString(); | 515 | param["GroupID"] = GroupID.ToString(); |
500 | 516 | ||
501 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMembership", param); | 517 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param); |
502 | 518 | ||
503 | if (respData.Contains("error")) | 519 | if (respData.Contains("error")) |
504 | { | 520 | { |
@@ -510,12 +526,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
510 | return data; | 526 | return data; |
511 | } | 527 | } |
512 | 528 | ||
513 | public GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, UUID AgentID) | 529 | public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID) |
514 | { | 530 | { |
515 | Hashtable param = new Hashtable(); | 531 | Hashtable param = new Hashtable(); |
516 | param["AgentID"] = AgentID.ToString(); | 532 | param["AgentID"] = AgentID.ToString(); |
517 | 533 | ||
518 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentActiveMembership", param); | 534 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param); |
519 | 535 | ||
520 | if (respData.Contains("error")) | 536 | if (respData.Contains("error")) |
521 | { | 537 | { |
@@ -525,12 +541,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
525 | return HashTableToGroupMembershipData(respData); | 541 | return HashTableToGroupMembershipData(respData); |
526 | } | 542 | } |
527 | 543 | ||
528 | public List<GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, UUID AgentID) | 544 | public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID) |
529 | { | 545 | { |
530 | Hashtable param = new Hashtable(); | 546 | Hashtable param = new Hashtable(); |
531 | param["AgentID"] = AgentID.ToString(); | 547 | param["AgentID"] = AgentID.ToString(); |
532 | 548 | ||
533 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentGroupMemberships", param); | 549 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param); |
534 | 550 | ||
535 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); | 551 | List<GroupMembershipData> memberships = new List<GroupMembershipData>(); |
536 | 552 | ||
@@ -545,13 +561,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
545 | return memberships; | 561 | return memberships; |
546 | } | 562 | } |
547 | 563 | ||
548 | public List<GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, UUID AgentID, UUID GroupID) | 564 | public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
549 | { | 565 | { |
550 | Hashtable param = new Hashtable(); | 566 | Hashtable param = new Hashtable(); |
551 | param["AgentID"] = AgentID.ToString(); | 567 | param["AgentID"] = AgentID.ToString(); |
552 | param["GroupID"] = GroupID.ToString(); | 568 | param["GroupID"] = GroupID.ToString(); |
553 | 569 | ||
554 | Hashtable respData = XmlRpcCall(requestID, "groups.getAgentRoles", param); | 570 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param); |
555 | 571 | ||
556 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 572 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
557 | 573 | ||
@@ -577,12 +593,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
577 | 593 | ||
578 | } | 594 | } |
579 | 595 | ||
580 | public List<GroupRolesData> GetGroupRoles(GroupRequestID requestID, UUID GroupID) | 596 | public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) |
581 | { | 597 | { |
582 | Hashtable param = new Hashtable(); | 598 | Hashtable param = new Hashtable(); |
583 | param["GroupID"] = GroupID.ToString(); | 599 | param["GroupID"] = GroupID.ToString(); |
584 | 600 | ||
585 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoles", param); | 601 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); |
586 | 602 | ||
587 | List<GroupRolesData> Roles = new List<GroupRolesData>(); | 603 | List<GroupRolesData> Roles = new List<GroupRolesData>(); |
588 | 604 | ||
@@ -610,12 +626,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
610 | 626 | ||
611 | 627 | ||
612 | 628 | ||
613 | public List<GroupMembersData> GetGroupMembers(GroupRequestID requestID, UUID GroupID) | 629 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) |
614 | { | 630 | { |
615 | Hashtable param = new Hashtable(); | 631 | Hashtable param = new Hashtable(); |
616 | param["GroupID"] = GroupID.ToString(); | 632 | param["GroupID"] = GroupID.ToString(); |
617 | 633 | ||
618 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupMembers", param); | 634 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param); |
619 | 635 | ||
620 | List<GroupMembersData> members = new List<GroupMembersData>(); | 636 | List<GroupMembersData> members = new List<GroupMembersData>(); |
621 | 637 | ||
@@ -643,12 +659,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
643 | 659 | ||
644 | } | 660 | } |
645 | 661 | ||
646 | public List<GroupRoleMembersData> GetGroupRoleMembers(GroupRequestID requestID, UUID GroupID) | 662 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
647 | { | 663 | { |
648 | Hashtable param = new Hashtable(); | 664 | Hashtable param = new Hashtable(); |
649 | param["GroupID"] = GroupID.ToString(); | 665 | param["GroupID"] = GroupID.ToString(); |
650 | 666 | ||
651 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupRoleMembers", param); | 667 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param); |
652 | 668 | ||
653 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); | 669 | List<GroupRoleMembersData> members = new List<GroupRoleMembersData>(); |
654 | 670 | ||
@@ -667,12 +683,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
667 | return members; | 683 | return members; |
668 | } | 684 | } |
669 | 685 | ||
670 | public List<GroupNoticeData> GetGroupNotices(GroupRequestID requestID, UUID GroupID) | 686 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) |
671 | { | 687 | { |
672 | Hashtable param = new Hashtable(); | 688 | Hashtable param = new Hashtable(); |
673 | param["GroupID"] = GroupID.ToString(); | 689 | param["GroupID"] = GroupID.ToString(); |
674 | 690 | ||
675 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotices", param); | 691 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param); |
676 | 692 | ||
677 | List<GroupNoticeData> values = new List<GroupNoticeData>(); | 693 | List<GroupNoticeData> values = new List<GroupNoticeData>(); |
678 | 694 | ||
@@ -694,12 +710,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
694 | return values; | 710 | return values; |
695 | 711 | ||
696 | } | 712 | } |
697 | public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, UUID noticeID) | 713 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
698 | { | 714 | { |
699 | Hashtable param = new Hashtable(); | 715 | Hashtable param = new Hashtable(); |
700 | param["NoticeID"] = noticeID.ToString(); | 716 | param["NoticeID"] = noticeID.ToString(); |
701 | 717 | ||
702 | Hashtable respData = XmlRpcCall(requestID, "groups.getGroupNotice", param); | 718 | Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param); |
703 | 719 | ||
704 | 720 | ||
705 | if (respData.Contains("error")) | 721 | if (respData.Contains("error")) |
@@ -725,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
725 | 741 | ||
726 | return data; | 742 | return data; |
727 | } | 743 | } |
728 | 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) |
729 | { | 745 | { |
730 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); | 746 | string binBucket = OpenMetaverse.Utils.BytesToHexString(binaryBucket, ""); |
731 | 747 | ||
@@ -738,7 +754,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
738 | param["BinaryBucket"] = binBucket; | 754 | param["BinaryBucket"] = binBucket; |
739 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); | 755 | param["TimeStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString(); |
740 | 756 | ||
741 | XmlRpcCall(requestID, "groups.addGroupNotice", param); | 757 | XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); |
742 | } | 758 | } |
743 | #endregion | 759 | #endregion |
744 | 760 | ||
@@ -831,15 +847,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
831 | /// <summary> | 847 | /// <summary> |
832 | /// Encapsulate the XmlRpc call to standardize security and error handling. | 848 | /// Encapsulate the XmlRpc call to standardize security and error handling. |
833 | /// </summary> | 849 | /// </summary> |
834 | private Hashtable XmlRpcCall(GroupRequestID requestID, string function, Hashtable param) | 850 | private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param) |
835 | { | 851 | { |
836 | if (requestID == null) | 852 | string UserService; |
837 | { | 853 | UUID SessionID; |
838 | requestID = new GroupRequestID(); | 854 | GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); |
839 | } | 855 | param.Add("requestingAgentID", requestingAgentID.ToString()); |
840 | param.Add("RequestingAgentID", requestID.AgentID.ToString()); | 856 | param.Add("RequestingAgentUserService", UserService); |
841 | param.Add("RequestingAgentUserService", requestID.UserServiceURL); | 857 | param.Add("RequestingSessionID", SessionID.ToString()); |
842 | param.Add("RequestingSessionID", requestID.SessionID.ToString()); | ||
843 | 858 | ||
844 | 859 | ||
845 | param.Add("ReadKey", m_groupReadKey); | 860 | param.Add("ReadKey", m_groupReadKey); |
@@ -930,15 +945,49 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
930 | } | 945 | } |
931 | } | 946 | } |
932 | 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; | ||
933 | 960 | ||
934 | } | ||
935 | 961 | ||
936 | public class GroupNoticeInfo | 962 | // Need to rework this based on changes to User Services |
937 | { | 963 | /* |
938 | public GroupNoticeData noticeData = new GroupNoticeData(); | 964 | UserAccount userAccount = m_accountService.GetUserAccount(UUID.Zero,AgentID); |
939 | public UUID GroupID = UUID.Zero; | 965 | if (userAccount == null) |
940 | public string Message = string.Empty; | 966 | { |
941 | 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 | |||
942 | } | 991 | } |
943 | } | 992 | } |
944 | 993 | ||