* 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>
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
= new CommunicationsLocal(
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
inventoryService, backendService, libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
CreateGridInfoService();
}
@ -202,22 +186,7 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
}
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
= new HGGridServicesStandalone(
m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache, m_openSim.SceneManager);
@ -225,10 +194,9 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
m_commsManager
= new HGCommunicationsStandalone(
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer, m_openSim.AssetCache,
inventoryService, gridService,
gridService,
libraryRootFolder, m_openSim.ConfigurationSettings.DumpAssetsToFile);
inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService;
HGServices = gridService;
CreateGridInfoService();

View File

@ -37,10 +37,12 @@ namespace OpenSim.Framework.Communications.Osp
public class OspInventoryWrapperPlugin : IInventoryDataPlugin
{
protected IInventoryDataPlugin m_wrappedPlugin;
protected CommunicationsManager m_commsManager;
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin)
public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager)
{
m_wrappedPlugin = wrappedPlugin;
m_commsManager = commsManager;
}
public string Name { get { return "OspInventoryWrapperPlugin"; } }
@ -51,24 +53,23 @@ namespace OpenSim.Framework.Communications.Osp
public InventoryItemBase getInventoryItem(UUID item)
{
return m_wrappedPlugin.getInventoryItem(item);
// TODO: Need to post process here
return PostProcessItem(m_wrappedPlugin.getInventoryItem(item));
}
// XXX: Why on earth does this exist as it appears to duplicate getInventoryItem?
public InventoryItemBase queryInventoryItem(UUID item)
{
return m_wrappedPlugin.queryInventoryItem(item);
// TODO: Need to post process here
return PostProcessItem(m_wrappedPlugin.queryInventoryItem(item));
}
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)
@ -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 (?)
}
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> 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="commsManager"></param>
/// <returns>
/// A suitable internal OpenSim identifier. If the input string wasn't ospi data, then we simply
/// return that same string. If the input string was ospi data but no valid profile information has been found,
/// then returns null.
/// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
/// is returned.
/// </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);
if (!ospa.StartsWith(OSPA_PREFIX))
return ospa;
return UUID.Zero;
string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
@ -116,7 +115,7 @@ namespace OpenSim.Framework.Communications.Osp
return ResolveOspaName(value, commsManager);
}
return null;
return UUID.Zero;
}
/// <summary>
@ -138,14 +137,14 @@ namespace OpenSim.Framework.Communications.Osp
/// <returns>
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
/// </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);
if (nameSeparatorIndex < 0)
{
m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
return null;
return UUID.Zero;
}
string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
@ -153,7 +152,7 @@ namespace OpenSim.Framework.Communications.Osp
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
if (userInfo != null)
return userInfo.UserProfile.ID.ToString();
return userInfo.UserProfile.ID;
UserProfileData tempUserProfile = new UserProfileData();
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);
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
return tempUserProfile.ID.ToString();
return tempUserProfile.ID;
}
}
}

View File

@ -48,38 +48,30 @@ namespace OpenSim.Framework
/// <value>
/// The creator of this item
/// </value>
public string CreatorId
{
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;
public string CreatorId { get; set; }
/// <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>
public UUID CreatorIdAsUuid
public UUID CreatorIdAsUuid
{
get
{
if (UUID.Zero == m_creatorIdAsUuid)
{
UUID.TryParse(CreatorId, out m_creatorIdAsUuid);
}
return m_creatorIdAsUuid;
}
set
{
m_creatorIdAsUuid = value;
}
}
private UUID m_creatorIdAsUuid = UUID.Zero;
}
protected UUID m_creatorIdAsUuid = UUID.Zero;
/// <value>
/// 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.
*/
using System.Collections.Generic;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Communications.Local;
@ -42,7 +45,6 @@ namespace OpenSim.Region.Communications.Hypergrid
NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
IAssetCache assetCache,
LocalInventoryService inventoryService,
HGGridServices gridService,
LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile)
@ -52,10 +54,24 @@ namespace OpenSim.Region.Communications.Hypergrid
new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
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);
m_defaultInventoryHost = inventoryService.Host;
m_interServiceInventoryService = inventoryService;
inventoryService.UserProfileCache = UserProfileCacheService;
m_assetCache = assetCache;
// 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.
*/
using System.Collections.Generic;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Osp;
using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Region.Communications.Local
@ -39,12 +42,22 @@ namespace OpenSim.Region.Communications.Local
NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
IAssetCache assetCache,
LocalInventoryService inventoryService,
IGridServices gridService,
LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile)
: 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);
m_defaultInventoryHost = inventoryService.Host;
m_interServiceInventoryService = inventoryService;
@ -58,8 +71,10 @@ namespace OpenSim.Region.Communications.Local
m_userAdminService = lus;
m_avatarService = 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
item.ID = UUID.Random();
string ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
if (null != ospResolvedId)
item.CreatorId = ospResolvedId;
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
if (UUID.Zero != ospResolvedId)
item.CreatorIdAsUuid = ospResolvedId;
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);
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));
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);
InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
Assert.That(foundItem.CreatorId, Is.EqualTo(user2Profile.ID.ToString()));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
Assert.That(
foundItem.CreatorIdAsUuid, Is.EqualTo(OspResolver.HashName(user2FirstName + " " + user2LastName)));
Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
}