diff options
author | Justin Clarke Casey | 2009-05-05 16:45:21 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-05-05 16:45:21 +0000 |
commit | f8e0653e73932bae20f483e0ce669f1623c6ff1e (patch) | |
tree | 9fc902fc17567755bad28f0f6d88b7089c0365e1 /OpenSim/Framework/Communications/Osp | |
parent | - moving banned check and public/private check to (diff) | |
download | opensim-SC-f8e0653e73932bae20f483e0ce669f1623c6ff1e.zip opensim-SC-f8e0653e73932bae20f483e0ce669f1623c6ff1e.tar.gz opensim-SC-f8e0653e73932bae20f483e0ce669f1623c6ff1e.tar.bz2 opensim-SC-f8e0653e73932bae20f483e0ce669f1623c6ff1e.tar.xz |
* If an item creator id contains an iar loaded name, create a temporary profile and hashed UUID to represent the user
Diffstat (limited to 'OpenSim/Framework/Communications/Osp')
-rw-r--r-- | OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs | 25 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Osp/OspResolver.cs | 19 |
2 files changed, 25 insertions, 19 deletions
diff --git a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs index 3a692ae..95ef484 100644 --- a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs +++ b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs | |||
@@ -37,10 +37,12 @@ namespace OpenSim.Framework.Communications.Osp | |||
37 | public class OspInventoryWrapperPlugin : IInventoryDataPlugin | 37 | public class OspInventoryWrapperPlugin : IInventoryDataPlugin |
38 | { | 38 | { |
39 | protected IInventoryDataPlugin m_wrappedPlugin; | 39 | protected IInventoryDataPlugin m_wrappedPlugin; |
40 | protected CommunicationsManager m_commsManager; | ||
40 | 41 | ||
41 | public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin) | 42 | public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager) |
42 | { | 43 | { |
43 | m_wrappedPlugin = wrappedPlugin; | 44 | m_wrappedPlugin = wrappedPlugin; |
45 | m_commsManager = commsManager; | ||
44 | } | 46 | } |
45 | 47 | ||
46 | public string Name { get { return "OspInventoryWrapperPlugin"; } } | 48 | public string Name { get { return "OspInventoryWrapperPlugin"; } } |
@@ -51,24 +53,23 @@ namespace OpenSim.Framework.Communications.Osp | |||
51 | 53 | ||
52 | public InventoryItemBase getInventoryItem(UUID item) | 54 | public InventoryItemBase getInventoryItem(UUID item) |
53 | { | 55 | { |
54 | return m_wrappedPlugin.getInventoryItem(item); | 56 | return PostProcessItem(m_wrappedPlugin.getInventoryItem(item)); |
55 | |||
56 | // TODO: Need to post process here | ||
57 | } | 57 | } |
58 | 58 | ||
59 | // XXX: Why on earth does this exist as it appears to duplicate getInventoryItem? | 59 | // XXX: Why on earth does this exist as it appears to duplicate getInventoryItem? |
60 | public InventoryItemBase queryInventoryItem(UUID item) | 60 | public InventoryItemBase queryInventoryItem(UUID item) |
61 | { | 61 | { |
62 | return m_wrappedPlugin.queryInventoryItem(item); | 62 | return PostProcessItem(m_wrappedPlugin.queryInventoryItem(item)); |
63 | |||
64 | // TODO: Need to post process here | ||
65 | } | 63 | } |
66 | 64 | ||
67 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) | 65 | public List<InventoryItemBase> getInventoryInFolder(UUID folderID) |
68 | { | 66 | { |
69 | return m_wrappedPlugin.getInventoryInFolder(folderID); | 67 | List<InventoryItemBase> items = m_wrappedPlugin.getInventoryInFolder(folderID); |
70 | 68 | ||
71 | // TODO: Need to post process here | 69 | foreach (InventoryItemBase item in items) |
70 | PostProcessItem(item); | ||
71 | |||
72 | return items; | ||
72 | } | 73 | } |
73 | 74 | ||
74 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) | 75 | public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) |
@@ -77,6 +78,12 @@ namespace OpenSim.Framework.Communications.Osp | |||
77 | 78 | ||
78 | // Presuming that no post processing is needed here as gestures don't refer to creator information (?) | 79 | // Presuming that no post processing is needed here as gestures don't refer to creator information (?) |
79 | } | 80 | } |
81 | |||
82 | protected InventoryItemBase PostProcessItem(InventoryItemBase item) | ||
83 | { | ||
84 | item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); | ||
85 | return item; | ||
86 | } | ||
80 | 87 | ||
81 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); } | 88 | public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); } |
82 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return m_wrappedPlugin.getUserRootFolders(user); } | 89 | public List<InventoryFolderBase> getUserRootFolders(UUID user) { return m_wrappedPlugin.getUserRootFolders(user); } |
diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index a62e1c0..579b3df 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs | |||
@@ -85,16 +85,15 @@ namespace OpenSim.Framework.Communications.Osp | |||
85 | /// <param name="ospa"></param> | 85 | /// <param name="ospa"></param> |
86 | /// <param name="commsManager"></param> | 86 | /// <param name="commsManager"></param> |
87 | /// <returns> | 87 | /// <returns> |
88 | /// A suitable internal OpenSim identifier. If the input string wasn't ospi data, then we simply | 88 | /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero |
89 | /// return that same string. If the input string was ospi data but no valid profile information has been found, | 89 | /// is returned. |
90 | /// then returns null. | ||
91 | /// </returns> | 90 | /// </returns> |
92 | public static string ResolveOspa(string ospa, CommunicationsManager commsManager) | 91 | public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) |
93 | { | 92 | { |
94 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); | 93 | m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); |
95 | 94 | ||
96 | if (!ospa.StartsWith(OSPA_PREFIX)) | 95 | if (!ospa.StartsWith(OSPA_PREFIX)) |
97 | return ospa; | 96 | return UUID.Zero; |
98 | 97 | ||
99 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); | 98 | string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); |
100 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); | 99 | string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); |
@@ -116,7 +115,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
116 | return ResolveOspaName(value, commsManager); | 115 | return ResolveOspaName(value, commsManager); |
117 | } | 116 | } |
118 | 117 | ||
119 | return null; | 118 | return UUID.Zero; |
120 | } | 119 | } |
121 | 120 | ||
122 | /// <summary> | 121 | /// <summary> |
@@ -138,14 +137,14 @@ namespace OpenSim.Framework.Communications.Osp | |||
138 | /// <returns> | 137 | /// <returns> |
139 | /// 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 |
140 | /// </returns> | 139 | /// </returns> |
141 | protected static string ResolveOspaName(string name, CommunicationsManager commsManager) | 140 | protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager) |
142 | { | 141 | { |
143 | int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); | 142 | int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); |
144 | 143 | ||
145 | if (nameSeparatorIndex < 0) | 144 | if (nameSeparatorIndex < 0) |
146 | { | 145 | { |
147 | m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); | 146 | m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); |
148 | return null; | 147 | return UUID.Zero; |
149 | } | 148 | } |
150 | 149 | ||
151 | string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); | 150 | string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); |
@@ -153,7 +152,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
153 | 152 | ||
154 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 153 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); |
155 | if (userInfo != null) | 154 | if (userInfo != null) |
156 | return userInfo.UserProfile.ID.ToString(); | 155 | return userInfo.UserProfile.ID; |
157 | 156 | ||
158 | UserProfileData tempUserProfile = new UserProfileData(); | 157 | UserProfileData tempUserProfile = new UserProfileData(); |
159 | tempUserProfile.FirstName = firstName; | 158 | tempUserProfile.FirstName = firstName; |
@@ -164,7 +163,7 @@ namespace OpenSim.Framework.Communications.Osp | |||
164 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); | 163 | "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); |
165 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); | 164 | commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); |
166 | 165 | ||
167 | return tempUserProfile.ID.ToString(); | 166 | return tempUserProfile.ID; |
168 | } | 167 | } |
169 | } | 168 | } |
170 | } | 169 | } |