diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | 59 |
1 files changed, 45 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 62b9bed..dd451ef 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -238,7 +238,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
238 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | 238 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) |
239 | { | 239 | { |
240 | if (IsLocalGridUser(userID)) | 240 | if (IsLocalGridUser(userID)) |
241 | return GetSystemFoldersLocal(userID); | 241 | { |
242 | // This is not pretty, but it will have to do for now | ||
243 | if (m_GridService is BaseInventoryConnector) | ||
244 | { | ||
245 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module"); | ||
246 | return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID); | ||
247 | } | ||
248 | else | ||
249 | { | ||
250 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal"); | ||
251 | return GetSystemFoldersLocal(userID); | ||
252 | } | ||
253 | } | ||
242 | else | 254 | else |
243 | { | 255 | { |
244 | UUID sessionID = GetSessionID(userID); | 256 | UUID sessionID = GetSessionID(userID); |
@@ -262,6 +274,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
262 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | 274 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) |
263 | folders[(AssetType)folder.Type] = folder; | 275 | folders[(AssetType)folder.Type] = folder; |
264 | } | 276 | } |
277 | // Put the root folder there, as type Folder | ||
278 | folders[AssetType.Folder] = root; | ||
265 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | 279 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); |
266 | return folders; | 280 | return folders; |
267 | } | 281 | } |
@@ -387,13 +401,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
387 | } | 401 | } |
388 | } | 402 | } |
389 | 403 | ||
390 | public override InventoryItemBase QueryItem(InventoryItemBase item) | 404 | public override InventoryItemBase GetItem(InventoryItemBase item) |
391 | { | 405 | { |
392 | if (item == null) | 406 | if (item == null) |
393 | return null; | 407 | return null; |
394 | 408 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); | |
395 | if (IsLocalGridUser(item.Owner)) | 409 | if (IsLocalGridUser(item.Owner)) |
396 | return m_GridService.QueryItem(item); | 410 | return m_GridService.GetItem(item); |
397 | else | 411 | else |
398 | { | 412 | { |
399 | UUID sessionID = GetSessionID(item.Owner); | 413 | UUID sessionID = GetSessionID(item.Owner); |
@@ -402,13 +416,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
402 | } | 416 | } |
403 | } | 417 | } |
404 | 418 | ||
405 | public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 419 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
406 | { | 420 | { |
407 | if (folder == null) | 421 | if (folder == null) |
408 | return null; | 422 | return null; |
409 | 423 | ||
410 | if (IsLocalGridUser(folder.Owner)) | 424 | if (IsLocalGridUser(folder.Owner)) |
411 | return m_GridService.QueryFolder(folder); | 425 | return m_GridService.GetFolder(folder); |
412 | else | 426 | else |
413 | { | 427 | { |
414 | UUID sessionID = GetSessionID(folder.Owner); | 428 | UUID sessionID = GetSessionID(folder.Owner); |
@@ -422,39 +436,56 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
422 | return false; | 436 | return false; |
423 | } | 437 | } |
424 | 438 | ||
425 | public override InventoryFolderBase GetRootFolder(UUID userID) | 439 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) |
426 | { | 440 | { |
427 | return null; | 441 | return new List<InventoryItemBase>(); |
428 | } | 442 | } |
429 | 443 | ||
430 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 444 | public override int GetAssetPermissions(UUID userID, UUID assetID) |
431 | { | 445 | { |
432 | return new List<InventoryItemBase>(); | 446 | if (IsLocalGridUser(userID)) |
447 | return m_GridService.GetAssetPermissions(userID, assetID); | ||
448 | else | ||
449 | { | ||
450 | UUID sessionID = GetSessionID(userID); | ||
451 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
452 | return m_HGService.GetAssetPermissions(uri, assetID, sessionID); | ||
453 | } | ||
433 | } | 454 | } |
434 | 455 | ||
435 | #endregion | 456 | #endregion |
436 | 457 | ||
437 | private UUID GetSessionID(UUID userID) | 458 | private UUID GetSessionID(UUID userID) |
438 | { | 459 | { |
439 | ScenePresence sp = m_Scene.GetScenePresence(userID); | 460 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); |
440 | if (sp != null) | 461 | if (uinfo != null) |
441 | return sp.ControllingClient.SessionId; | 462 | return uinfo.SessionID; |
442 | 463 | ||
464 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID); | ||
443 | return UUID.Zero; | 465 | return UUID.Zero; |
444 | } | 466 | } |
445 | 467 | ||
446 | private bool IsLocalGridUser(UUID userID) | 468 | private bool IsLocalGridUser(UUID userID) |
447 | { | 469 | { |
448 | if (m_UserProfileService == null) | 470 | if (m_UserProfileService == null) |
471 | { | ||
472 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false."); | ||
449 | return false; | 473 | return false; |
474 | } | ||
450 | 475 | ||
451 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); | 476 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); |
452 | if (uinfo == null) | 477 | if (uinfo == null) |
478 | { | ||
479 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID); | ||
453 | return true; | 480 | return true; |
481 | } | ||
454 | 482 | ||
455 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | 483 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); |
484 | string uri = m_LocalGridInventoryURI.TrimEnd('/'); | ||
485 | |||
486 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri); | ||
456 | 487 | ||
457 | if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == "")) | 488 | if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) |
458 | { | 489 | { |
459 | return true; | 490 | return true; |
460 | } | 491 | } |