diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Osp')
-rw-r--r-- | OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Osp/OspResolver.cs | 22 |
2 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs index e96c5e8..bcd1eee 100644 --- a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs +++ b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using OpenSim.Data; | 29 | using OpenSim.Data; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Services.Interfaces; | ||
31 | 32 | ||
32 | namespace OpenSim.Framework.Communications.Osp | 33 | namespace OpenSim.Framework.Communications.Osp |
33 | { | 34 | { |
@@ -37,12 +38,13 @@ namespace OpenSim.Framework.Communications.Osp | |||
37 | public class OspInventoryWrapperPlugin : IInventoryDataPlugin | 38 | public class OspInventoryWrapperPlugin : IInventoryDataPlugin |
38 | { | 39 | { |
39 | protected IInventoryDataPlugin m_wrappedPlugin; | 40 | protected IInventoryDataPlugin m_wrappedPlugin; |
40 | protected CommunicationsManager m_commsManager; | 41 | //protected CommunicationsManager m_commsManager; |
42 | protected IUserAccountService m_userAccountService; | ||
41 | 43 | ||
42 | public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager) | 44 | public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, IUserAccountService userService) |
43 | { | 45 | { |
44 | m_wrappedPlugin = wrappedPlugin; | 46 | m_wrappedPlugin = wrappedPlugin; |
45 | m_commsManager = commsManager; | 47 | m_userAccountService = userService; |
46 | } | 48 | } |
47 | 49 | ||
48 | public string Name { get { return "OspInventoryWrapperPlugin"; } } | 50 | public string Name { get { return "OspInventoryWrapperPlugin"; } } |
@@ -81,7 +83,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
81 | 83 | ||
82 | protected InventoryItemBase PostProcessItem(InventoryItemBase item) | 84 | protected InventoryItemBase PostProcessItem(InventoryItemBase item) |
83 | { | 85 | { |
84 | item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); | 86 | item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_userAccountService); |
85 | return item; | 87 | return item; |
86 | } | 88 | } |
87 | 89 | ||
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 4013896..2e55f53 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs | |||
@@ -30,7 +30,7 @@ using System.Text; | |||
30 | using log4net; | 30 | using log4net; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Services.Interfaces; |
34 | 34 | ||
35 | namespace OpenSim.Framework.Communications.Osp | 35 | namespace OpenSim.Framework.Communications.Osp |
36 | { | 36 | { |
@@ -55,11 +55,11 @@ namespace OpenSim.Framework.Communications.Osp | |||
55 | /// <param name="userId"></param> | 55 | /// <param name="userId"></param> |
56 | /// <param name="commsManager"></param> | 56 | /// <param name="commsManager"></param> |
57 | /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> | 57 | /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> |
58 | public static string MakeOspa(UUID userId, CommunicationsManager commsManager) | 58 | public static string MakeOspa(UUID userId, IUserAccountService userService) |
59 | { | 59 | { |
60 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | 60 | UserAccount account = userService.GetUserAccount(UUID.Zero, userId); |
61 | if (userInfo != null) | 61 | if (account != null) |
62 | return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName); | 62 | return MakeOspa(account.FirstName, account.LastName); |
63 | 63 | ||
64 | return null; | 64 | return null; |
65 | } | 65 | } |
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
88 | /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero | 88 | /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero |
89 | /// is returned. | 89 | /// is returned. |
90 | /// </returns> | 90 | /// </returns> |
91 | public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) | 91 | public static UUID ResolveOspa(string ospa, IUserAccountService userService) |
92 | { | 92 | { |
93 | if (!ospa.StartsWith(OSPA_PREFIX)) | 93 | if (!ospa.StartsWith(OSPA_PREFIX)) |
94 | return UUID.Zero; | 94 | return UUID.Zero; |
@@ -112,7 +112,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
112 | string value = tuple.Substring(tupleSeparatorIndex + 1).Trim(); | 112 | string value = tuple.Substring(tupleSeparatorIndex + 1).Trim(); |
113 | 113 | ||
114 | if (OSPA_NAME_KEY == key) | 114 | if (OSPA_NAME_KEY == key) |
115 | return ResolveOspaName(value, commsManager); | 115 | return ResolveOspaName(value, userService); |
116 | } | 116 | } |
117 | 117 | ||
118 | return UUID.Zero; | 118 | return UUID.Zero; |
@@ -137,7 +137,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
137 | /// <returns> | 137 | /// <returns> |
138 | /// An OpenSim internal identifier for the name given. Returns null if the name was not valid | 138 | /// An OpenSim internal identifier for the name given. Returns null if the name was not valid |
139 | /// </returns> | 139 | /// </returns> |
140 | protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager) | 140 | protected static UUID ResolveOspaName(string name, IUserAccountService userService) |
141 | { | 141 | { |
142 | int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); | 142 | int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); |
143 | 143 | ||
@@ -150,9 +150,9 @@ namespace OpenSim.Framework.Communications.Osp | |||
150 | string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); | 150 | string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); |
151 | string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); | 151 | string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); |
152 | 152 | ||
153 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 153 | UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); |
154 | if (userInfo != null) | 154 | if (account != null) |
155 | return userInfo.UserProfile.ID; | 155 | return account.PrincipalID; |
156 | 156 | ||
157 | // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc | 157 | // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc |
158 | /* | 158 | /* |