* If an item creator id contains an iar loaded name, create a temporary profile and hashed UUID to represent the user

0.6.5-rc1
Justin Clarke Casey 2009-05-05 16:45:21 +00:00
parent e0a06f6416
commit f8e0653e73
8 changed files with 86 additions and 86 deletions

View File

@ -166,26 +166,10 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
/// <param name="libraryRootFolder"></param> /// <param name="libraryRootFolder"></param>
protected virtual void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) protected virtual void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
{ {
LocalInventoryService inventoryService = new LocalInventoryService();
List<IInventoryDataPlugin> plugins
= DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
m_openSim.ConfigurationSettings.StandaloneInventoryPlugin,
m_openSim.ConfigurationSettings.StandaloneInventorySource);
foreach (IInventoryDataPlugin plugin in plugins)
{
// Using the OSP wrapper plugin for database plugins should be made configurable at some point
inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin));
}
LocalBackEndServices backendService = new LocalBackEndServices();
//LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
m_commsManager m_commsManager
= new CommunicationsLocal( = new CommunicationsLocal(
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
inventoryService, backendService, libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile); libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
CreateGridInfoService(); CreateGridInfoService();
} }
@ -202,22 +186,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
} }
protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder) protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
{ {
// Standalone mode
HGInventoryServiceClient inventoryService
= new HGInventoryServiceClient(m_openSim.NetServersInfo.InventoryURL, null, false);
List<IInventoryDataPlugin> plugins
= DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
m_openSim.ConfigurationSettings.StandaloneInventoryPlugin,
m_openSim.ConfigurationSettings.StandaloneInventorySource);
foreach (IInventoryDataPlugin plugin in plugins)
{
// Using the OSP wrapper plugin should be made configurable at some point
inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin));
}
HGGridServicesStandalone gridService HGGridServicesStandalone gridService
= new HGGridServicesStandalone( = new HGGridServicesStandalone(
m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager); m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager);
@ -225,10 +194,9 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
m_commsManager m_commsManager
= new HGCommunicationsStandalone( = new HGCommunicationsStandalone(
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
inventoryService, gridService, gridService,
libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile); libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService;
HGServices = gridService; HGServices = gridService;
CreateGridInfoService(); CreateGridInfoService();

View File

@ -37,10 +37,12 @@ namespace OpenSim.Framework.Communications.Osp
public class OspInventoryWrapperPlugin : IInventoryDataPlugin public class OspInventoryWrapperPlugin : IInventoryDataPlugin
{ {
protected IInventoryDataPlugin m_wrappedPlugin; protected IInventoryDataPlugin m_wrappedPlugin;
protected CommunicationsManager m_commsManager;
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin) public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager)
{ {
m_wrappedPlugin = wrappedPlugin; m_wrappedPlugin = wrappedPlugin;
m_commsManager = commsManager;
} }
public string Name { get { return "OspInventoryWrapperPlugin"; } } public string Name { get { return "OspInventoryWrapperPlugin"; } }
@ -51,24 +53,23 @@ namespace OpenSim.Framework.Communications.Osp
public InventoryItemBase getInventoryItem(UUID item) public InventoryItemBase getInventoryItem(UUID item)
{ {
return m_wrappedPlugin.getInventoryItem(item); return PostProcessItem(m_wrappedPlugin.getInventoryItem(item));
// TODO: Need to post process here
} }
// XXX: Why on earth does this exist as it appears to duplicate getInventoryItem? // XXX: Why on earth does this exist as it appears to duplicate getInventoryItem?
public InventoryItemBase queryInventoryItem(UUID item) public InventoryItemBase queryInventoryItem(UUID item)
{ {
return m_wrappedPlugin.queryInventoryItem(item); return PostProcessItem(m_wrappedPlugin.queryInventoryItem(item));
// TODO: Need to post process here
} }
public List<InventoryItemBase> getInventoryInFolder(UUID folderID) public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{ {
return m_wrappedPlugin.getInventoryInFolder(folderID); List<InventoryItemBase> items = m_wrappedPlugin.getInventoryInFolder(folderID);
// TODO: Need to post process here foreach (InventoryItemBase item in items)
PostProcessItem(item);
return items;
} }
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID) public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
@ -77,6 +78,12 @@ namespace OpenSim.Framework.Communications.Osp
// Presuming that no post processing is needed here as gestures don't refer to creator information (?) // Presuming that no post processing is needed here as gestures don't refer to creator information (?)
} }
protected InventoryItemBase PostProcessItem(InventoryItemBase item)
{
item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
return item;
}
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); } public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); }
public List<InventoryFolderBase> getUserRootFolders(UUID user) { return m_wrappedPlugin.getUserRootFolders(user); } public List<InventoryFolderBase> getUserRootFolders(UUID user) { return m_wrappedPlugin.getUserRootFolders(user); }

View File

@ -85,16 +85,15 @@ namespace OpenSim.Framework.Communications.Osp
/// <param name="ospa"></param> /// <param name="ospa"></param>
/// <param name="commsManager"></param> /// <param name="commsManager"></param>
/// <returns> /// <returns>
/// A suitable internal OpenSim identifier. If the input string wasn't ospi data, then we simply /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
/// return that same string. If the input string was ospi data but no valid profile information has been found, /// is returned.
/// then returns null.
/// </returns> /// </returns>
public static string ResolveOspa(string ospa, CommunicationsManager commsManager) public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager)
{ {
m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
if (!ospa.StartsWith(OSPA_PREFIX)) if (!ospa.StartsWith(OSPA_PREFIX))
return ospa; return UUID.Zero;
string ospaMeat = ospa.Substring(OSPA_PREFIX.Length); string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY); string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
@ -116,7 +115,7 @@ namespace OpenSim.Framework.Communications.Osp
return ResolveOspaName(value, commsManager); return ResolveOspaName(value, commsManager);
} }
return null; return UUID.Zero;
} }
/// <summary> /// <summary>
@ -138,14 +137,14 @@ namespace OpenSim.Framework.Communications.Osp
/// <returns> /// <returns>
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid /// An OpenSim internal identifier for the name given. Returns null if the name was not valid
/// </returns> /// </returns>
protected static string ResolveOspaName(string name, CommunicationsManager commsManager) protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager)
{ {
int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
if (nameSeparatorIndex < 0) if (nameSeparatorIndex < 0)
{ {
m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name); m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
return null; return UUID.Zero;
} }
string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
@ -153,7 +152,7 @@ namespace OpenSim.Framework.Communications.Osp
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (userInfo != null) if (userInfo != null)
return userInfo.UserProfile.ID.ToString(); return userInfo.UserProfile.ID;
UserProfileData tempUserProfile = new UserProfileData(); UserProfileData tempUserProfile = new UserProfileData();
tempUserProfile.FirstName = firstName; tempUserProfile.FirstName = firstName;
@ -164,7 +163,7 @@ namespace OpenSim.Framework.Communications.Osp
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID); "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile); commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID.ToString(); return tempUserProfile.ID;
} }
} }
} }

View File

@ -48,38 +48,30 @@ namespace OpenSim.Framework
/// <value> /// <value>
/// The creator of this item /// The creator of this item
/// </value> /// </value>
public string CreatorId public string CreatorId { get; set; }
{
get { return m_creatorId; }
set
{
m_creatorId = value;
UUID creatorIdAsUuid;
// For now, all IDs are UUIDs
UUID.TryParse(m_creatorId, out creatorIdAsUuid);
CreatorIdAsUuid = creatorIdAsUuid;
}
}
private string m_creatorId = String.Empty;
/// <value> /// <value>
/// The creator of this item expressed as a UUID /// The creator of this item expressed as a UUID. Database plugins don't need to set this, it will be set by
/// upstream code (or set by the get accessor if left unset).
/// </value> /// </value>
public UUID CreatorIdAsUuid public UUID CreatorIdAsUuid
{ {
get get
{ {
if (UUID.Zero == m_creatorIdAsUuid)
{
UUID.TryParse(CreatorId, out m_creatorIdAsUuid);
}
return m_creatorIdAsUuid; return m_creatorIdAsUuid;
} }
set set
{ {
m_creatorIdAsUuid = value; m_creatorIdAsUuid = value;
} }
} }
protected UUID m_creatorIdAsUuid = UUID.Zero;
private UUID m_creatorIdAsUuid = UUID.Zero;
/// <value> /// <value>
/// The description of the inventory item (must be less than 64 characters) /// The description of the inventory item (must be less than 64 characters)

View File

@ -25,9 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Collections.Generic;
using OpenSim.Data;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Communications.Local; using OpenSim.Region.Communications.Local;
@ -42,7 +45,6 @@ namespace OpenSim.Region.Communications.Hypergrid
NetworkServersInfo serversInfo, NetworkServersInfo serversInfo,
BaseHttpServer httpServer, BaseHttpServer httpServer,
IAssetCache assetCache, IAssetCache assetCache,
LocalInventoryService inventoryService,
HGGridServices gridService, HGGridServices gridService,
LibraryRootFolder libraryRootFolder, LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile) bool dumpAssetsToFile)
@ -52,10 +54,24 @@ namespace OpenSim.Region.Communications.Hypergrid
new LocalUserServices( new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this); serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource); localUserService.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
HGInventoryServiceClient inventoryService
= new HGInventoryServiceClient(serversInfo.InventoryURL, null, false);
List<IInventoryDataPlugin> plugins
= DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
configSettings.StandaloneInventoryPlugin,
configSettings.StandaloneInventorySource);
foreach (IInventoryDataPlugin plugin in plugins)
{
// Using the OSP wrapper plugin should be made configurable at some point
inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
}
AddInventoryService(inventoryService); AddInventoryService(inventoryService);
m_defaultInventoryHost = inventoryService.Host; m_defaultInventoryHost = inventoryService.Host;
m_interServiceInventoryService = inventoryService; m_interServiceInventoryService = inventoryService;
inventoryService.UserProfileCache = UserProfileCacheService;
m_assetCache = assetCache; m_assetCache = assetCache;
// Let's swap to always be secure access to inventory // Let's swap to always be secure access to inventory

View File

@ -25,9 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Collections.Generic;
using OpenSim.Data;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
@ -39,12 +42,22 @@ namespace OpenSim.Region.Communications.Local
NetworkServersInfo serversInfo, NetworkServersInfo serversInfo,
BaseHttpServer httpServer, BaseHttpServer httpServer,
IAssetCache assetCache, IAssetCache assetCache,
LocalInventoryService inventoryService,
IGridServices gridService,
LibraryRootFolder libraryRootFolder, LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile) bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder) : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder)
{ {
LocalInventoryService inventoryService = new LocalInventoryService();
List<IInventoryDataPlugin> plugins
= DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(
configSettings.StandaloneInventoryPlugin,
configSettings.StandaloneInventorySource);
foreach (IInventoryDataPlugin plugin in plugins)
{
// Using the OSP wrapper plugin for database plugins should be made configurable at some point
inventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this));
}
AddInventoryService(inventoryService); AddInventoryService(inventoryService);
m_defaultInventoryHost = inventoryService.Host; m_defaultInventoryHost = inventoryService.Host;
m_interServiceInventoryService = inventoryService; m_interServiceInventoryService = inventoryService;
@ -58,8 +71,10 @@ namespace OpenSim.Region.Communications.Local
m_userAdminService = lus; m_userAdminService = lus;
m_avatarService = lus; m_avatarService = lus;
m_messageService = lus; m_messageService = lus;
m_gridService = gridService; m_gridService = new LocalBackEndServices();
//LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
} }
} }
} }

View File

@ -157,9 +157,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Don't use the item ID that's in the file // Don't use the item ID that's in the file
item.ID = UUID.Random(); item.ID = UUID.Random();
string ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
if (null != ospResolvedId) if (UUID.Zero != ospResolvedId)
item.CreatorId = ospResolvedId; item.CreatorIdAsUuid = ospResolvedId;
item.Owner = m_userInfo.UserProfile.ID; item.Owner = m_userInfo.UserProfile.ID;

View File

@ -253,7 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
Assert.That(foundItem.CreatorId, Is.EqualTo(user2Uuid.ToString())); Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
Assert.That(foundItem.CreatorIdAsUuid, Is.EqualTo(user2Uuid));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
@ -321,8 +322,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
= scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString())); Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); Assert.That(
foundItem.CreatorIdAsUuid, Is.EqualTo(OspResolver.HashName(user2FirstName + " " + user2LastName)));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod()); Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
} }