From c617d658dda92ad97de678d477a98c3df0659303 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Nov 2010 17:19:24 -0800 Subject: Added creator info across the board -- TaskInventoryItems and InventoryItems themselves. Tested. Seems to be working, main tests pass. Nothing done for IARs or HG transfers yet -- this only works for OARs for the time being. New migration in inventory table in order to make CreatorID varchar(255). --- .../RemoteController/RemoteAdminPlugin.cs | 6 ++- .../Rest/Inventory/RestInventoryServices.cs | 1 + OpenSim/Data/MySQL/MySQLSimulationData.cs | 4 +- .../Data/MySQL/Resources/InventoryStore.migrations | 8 +++ .../Data/MySQL/Resources/RegionStore.migrations | 1 + OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 4 +- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 4 +- OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs | 4 +- OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 4 +- OpenSim/Framework/InventoryItemBase.cs | 50 ++++++++++++++++++ OpenSim/Framework/TaskInventoryItem.cs | 56 ++++++++++++++++++++ .../InventoryAccess/InventoryAccessModule.cs | 1 + .../UserManagement/UserManagementModule.cs | 61 +++++++++++++--------- .../Inventory/LocalInventoryServiceConnector.cs | 25 ++++++++- .../Inventory/RemoteInventoryServiceConnector.cs | 24 ++++++++- .../World/Archiver/ArchiveReadRequest.cs | 10 ++-- .../World/Objects/BuySell/BuySellModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 20 ++++--- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++- .../Scenes/Serialization/SceneObjectSerializer.cs | 23 +++++++- .../Handlers/Inventory/XInventoryInConnector.cs | 2 + .../Connectors/Inventory/XInventoryConnector.cs | 3 ++ .../SimianGrid/SimianInventoryServiceConnector.cs | 2 + .../Services/InventoryService/XInventoryService.cs | 4 +- 24 files changed, 272 insertions(+), 53 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 15adb99..c09252a 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1584,6 +1584,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; + destinationItem.CreatorData = item.CreatorData; destinationItem.NextPermissions = item.NextPermissions; destinationItem.CurrentPermissions = item.CurrentPermissions; destinationItem.BasePermissions = item.BasePermissions; @@ -1636,6 +1637,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; + destinationItem.CreatorData = item.CreatorData; destinationItem.NextPermissions = item.NextPermissions; destinationItem.CurrentPermissions = item.CurrentPermissions; destinationItem.BasePermissions = item.BasePermissions; @@ -1743,6 +1745,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController destinationItem.InvType = item.InvType; destinationItem.CreatorId = item.CreatorId; destinationItem.CreatorIdAsUuid = item.CreatorIdAsUuid; + destinationItem.CreatorData = item.CreatorData; destinationItem.NextPermissions = item.NextPermissions; destinationItem.CurrentPermissions = item.CurrentPermissions; destinationItem.BasePermissions = item.BasePermissions; @@ -2026,7 +2029,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController inventoryItem.InvType = GetIntegerAttribute(item,"invtype",-1); inventoryItem.CreatorId = GetStringAttribute(item,"creatorid",""); inventoryItem.CreatorIdAsUuid = (UUID)GetStringAttribute(item,"creatoruuid",""); - inventoryItem.NextPermissions = GetUnsignedAttribute(perms,"next",0x7fffffff); + inventoryItem.CreatorData = GetStringAttribute(item, "creatordata", ""); + inventoryItem.NextPermissions = GetUnsignedAttribute(perms, "next", 0x7fffffff); inventoryItem.CurrentPermissions = GetUnsignedAttribute(perms,"current",0x7fffffff); inventoryItem.BasePermissions = GetUnsignedAttribute(perms,"base",0x7fffffff); inventoryItem.EveryOnePermissions = GetUnsignedAttribute(perms,"everyone",0x7fffffff); diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index a4135db..c3cf08c 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -1295,6 +1295,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory rdata.writer.WriteAttributeString("folder", String.Empty, i.Folder.ToString()); rdata.writer.WriteAttributeString("owner", String.Empty, i.Owner.ToString()); rdata.writer.WriteAttributeString("creator", String.Empty, i.CreatorId); + rdata.writer.WriteAttributeString("creatordata", String.Empty, i.CreatorData); rdata.writer.WriteAttributeString("creationdate", String.Empty, i.CreationDate.ToString()); rdata.writer.WriteAttributeString("invtype", String.Empty, i.InvType.ToString()); rdata.writer.WriteAttributeString("assettype", String.Empty, i.AssetType.ToString()); diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index f630dc1..02997b3 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -1243,7 +1243,7 @@ namespace OpenSim.Data.MySQL taskItem.Name = (String)row["name"]; taskItem.Description = (String)row["description"]; taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = DBGuid.FromDB(row["creatorID"]); + taskItem.CreatorIdentification = (String)row["creatorID"]; taskItem.OwnerID = DBGuid.FromDB(row["ownerID"]); taskItem.LastOwnerID = DBGuid.FromDB(row["lastOwnerID"]); taskItem.GroupID = DBGuid.FromDB(row["groupID"]); @@ -1583,7 +1583,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("name", taskItem.Name); cmd.Parameters.AddWithValue("description", taskItem.Description); cmd.Parameters.AddWithValue("creationDate", taskItem.CreationDate); - cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorID); + cmd.Parameters.AddWithValue("creatorID", taskItem.CreatorIdentification); cmd.Parameters.AddWithValue("ownerID", taskItem.OwnerID); cmd.Parameters.AddWithValue("lastOwnerID", taskItem.LastOwnerID); cmd.Parameters.AddWithValue("groupID", taskItem.GroupID); diff --git a/OpenSim/Data/MySQL/Resources/InventoryStore.migrations b/OpenSim/Data/MySQL/Resources/InventoryStore.migrations index 3e9bad5..993a5a0 100644 --- a/OpenSim/Data/MySQL/Resources/InventoryStore.migrations +++ b/OpenSim/Data/MySQL/Resources/InventoryStore.migrations @@ -99,3 +99,11 @@ BEGIN; alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000'; COMMIT; + +:VERSION 6 # ------------ + +BEGIN; + +alter table inventoryitems modify column creatorID varchar(255) not NULL default '00000000-0000-0000-0000-000000000000'; + +COMMIT; diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 364c4d3..ba8d538 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -823,5 +823,6 @@ COMMIT; BEGIN; ALTER TABLE `prims` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT ''; +ALTER TABLE `primitems` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT ''; COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index d606f11..7dc07ec 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -156,7 +156,7 @@ namespace OpenSim.Data.SQLite item.InvType = Convert.ToInt32(row["invType"]); item.Folder = new UUID((string) row["parentFolderID"]); item.Owner = new UUID((string) row["avatarID"]); - item.CreatorId = (string)row["creatorsID"]; + item.CreatorIdentification = (string)row["creatorsID"]; item.Name = (string) row["inventoryName"]; item.Description = (string) row["inventoryDescription"]; @@ -201,7 +201,7 @@ namespace OpenSim.Data.SQLite row["invType"] = item.InvType; row["parentFolderID"] = item.Folder.ToString(); row["avatarID"] = item.Owner.ToString(); - row["creatorsID"] = item.CreatorId.ToString(); + row["creatorsID"] = item.CreatorIdentification.ToString(); row["inventoryName"] = item.Name; row["inventoryDescription"] = item.Description; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 85a3a37..0bfd73a 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1385,7 +1385,7 @@ namespace OpenSim.Data.SQLite taskItem.Name = (String)row["name"]; taskItem.Description = (String)row["description"]; taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = new UUID((String)row["creatorID"]); + taskItem.CreatorIdentification = (String)row["creatorID"]; taskItem.OwnerID = new UUID((String)row["ownerID"]); taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); taskItem.GroupID = new UUID((String)row["groupID"]); @@ -1716,7 +1716,7 @@ namespace OpenSim.Data.SQLite row["name"] = taskItem.Name; row["description"] = taskItem.Description; row["creationDate"] = taskItem.CreationDate; - row["creatorID"] = taskItem.CreatorID.ToString(); + row["creatorID"] = taskItem.CreatorIdentification.ToString(); row["ownerID"] = taskItem.OwnerID.ToString(); row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); row["groupID"] = taskItem.GroupID.ToString(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs index 726703b..8ca48f9 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs @@ -150,7 +150,7 @@ namespace OpenSim.Data.SQLiteLegacy item.InvType = Convert.ToInt32(row["invType"]); item.Folder = new UUID((string) row["parentFolderID"]); item.Owner = new UUID((string) row["avatarID"]); - item.CreatorId = (string)row["creatorsID"]; + item.CreatorIdentification = (string)row["creatorsID"]; item.Name = (string) row["inventoryName"]; item.Description = (string) row["inventoryDescription"]; @@ -195,7 +195,7 @@ namespace OpenSim.Data.SQLiteLegacy row["invType"] = item.InvType; row["parentFolderID"] = item.Folder.ToString(); row["avatarID"] = item.Owner.ToString(); - row["creatorsID"] = item.CreatorId.ToString(); + row["creatorsID"] = item.CreatorIdentification.ToString(); row["inventoryName"] = item.Name; row["inventoryDescription"] = item.Description; diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index bcc1006..1ad1e66 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -1334,7 +1334,7 @@ namespace OpenSim.Data.SQLiteLegacy taskItem.Name = (String)row["name"]; taskItem.Description = (String)row["description"]; taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); - taskItem.CreatorID = new UUID((String)row["creatorID"]); + taskItem.CreatorIdentification = (String)row["creatorID"]; taskItem.OwnerID = new UUID((String)row["ownerID"]); taskItem.LastOwnerID = new UUID((String)row["lastOwnerID"]); taskItem.GroupID = new UUID((String)row["groupID"]); @@ -1664,7 +1664,7 @@ namespace OpenSim.Data.SQLiteLegacy row["name"] = taskItem.Name; row["description"] = taskItem.Description; row["creationDate"] = taskItem.CreationDate; - row["creatorID"] = taskItem.CreatorID.ToString(); + row["creatorID"] = taskItem.CreatorIdentification.ToString(); row["ownerID"] = taskItem.OwnerID.ToString(); row["lastOwnerID"] = taskItem.LastOwnerID.ToString(); row["groupID"] = taskItem.GroupID.ToString(); diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index aeb01e2..ce4fc38 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -117,6 +117,56 @@ namespace OpenSim.Framework } protected UUID m_creatorIdAsUuid = UUID.Zero; + protected string m_creatorData; + public string CreatorData // = ; + { + get { return m_creatorData; } + set { m_creatorData = value; } + } + + /// + /// Used by the DB layer to retrieve / store the entire user identification. + /// The identification can either be a simple UUID or a string of the form + /// uuid[;profile_url[;name]] + /// + public string CreatorIdentification + { + get + { + if (m_creatorData != null && m_creatorData != string.Empty) + return m_creatorId + ';' + m_creatorData; + else + return m_creatorId; + } + set + { + if ((value == null) || (value != null && value == string.Empty)) + { + m_creatorData = string.Empty; + return; + } + + if (!value.Contains(";")) // plain UUID + { + m_creatorId = value; + } + else // [;[;name]] + { + string name = "Unknown User"; + string[] parts = value.Split(';'); + if (parts.Length >= 1) + m_creatorId = parts[0]; + if (parts.Length >= 2) + m_creatorData = parts[1]; + if (parts.Length >= 3) + name = parts[2]; + + m_creatorData += ';' + name; + + } + } + } + /// /// The description of the inventory item (must be less than 64 characters) /// diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index df5b936..30d775c 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -102,6 +102,7 @@ namespace OpenSim.Framework private uint _baseMask = FULL_MASK_PERMISSIONS_GENERAL; private uint _creationDate = 0; private UUID _creatorID = UUID.Zero; + private string _creatorData = String.Empty; private string _description = String.Empty; private uint _everyoneMask = FULL_MASK_PERMISSIONS_GENERAL; private uint _flags = 0; @@ -160,6 +161,61 @@ namespace OpenSim.Framework } } + public string CreatorData // = ; + { + get { return _creatorData; } + set { _creatorData = value; } + } + + /// + /// Used by the DB layer to retrieve / store the entire user identification. + /// The identification can either be a simple UUID or a string of the form + /// uuid[;profile_url[;name]] + /// + public string CreatorIdentification + { + get + { + if (_creatorData != null && _creatorData != string.Empty) + return _creatorID.ToString() + ';' + _creatorData; + else + return _creatorID.ToString(); + } + set + { + if ((value == null) || (value != null && value == string.Empty)) + { + _creatorData = string.Empty; + return; + } + + if (!value.Contains(";")) // plain UUID + { + UUID uuid = UUID.Zero; + UUID.TryParse(value, out uuid); + _creatorID = uuid; + } + else // [;[;name]] + { + string name = "Unknown User"; + string[] parts = value.Split(';'); + if (parts.Length >= 1) + { + UUID uuid = UUID.Zero; + UUID.TryParse(parts[0], out uuid); + _creatorID = uuid; + } + if (parts.Length >= 2) + _creatorData = parts[1]; + if (parts.Length >= 3) + name = parts[2]; + + _creatorData += ';' + name; + + } + } + } + public string Description { get { return _description; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index ef21834..67732ff 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -370,6 +370,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess item = new InventoryItemBase(); item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); + item.CreatorData = objectGroup.RootPart.CreatorData; item.ID = UUID.Random(); item.InvType = (int)InventoryType.Object; item.Folder = folder.ID; diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 88ed763..0d94baa 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -164,7 +164,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); foreach (SceneObjectPart sop in sog.Parts) + { AddUser(sop.CreatorID, sop.CreatorData); + foreach (TaskInventoryItem item in sop.TaskInventory.Values) + AddUser(item.CreatorID, item.CreatorData); + } } @@ -226,40 +230,49 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData user = new UserData(); user.Id = id; - if (creatorData != null && creatorData != string.Empty) - { - //creatorData = ; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); - string[] parts = creatorData.Split(';'); - if (parts.Length >= 1) - { - user.ProfileURL = parts[0]; - try - { - Uri uri = new Uri(parts[0]); - user.LastName = "@" + uri.Authority; - } - catch - { - m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); - user.LastName = "@unknown"; - } - } - if (parts.Length >= 2) - user.FirstName = parts[1].Replace(' ', '.'); - } - else + if (account != null) { - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); user.FirstName = account.FirstName; user.LastName = account.LastName; // user.ProfileURL = we should initialize this to the default } + else + { + if (creatorData != null && creatorData != string.Empty) + { + //creatorData = ; + + string[] parts = creatorData.Split(';'); + if (parts.Length >= 1) + { + user.ProfileURL = parts[0]; + try + { + Uri uri = new Uri(parts[0]); + user.LastName = "@" + uri.Authority; + } + catch + { + m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); + user.LastName = "@unknown"; + } + } + if (parts.Length >= 2) + user.FirstName = parts[1].Replace(' ', '.'); + } + else + { + user.FirstName = "Unknown"; + user.LastName = "User"; + } + } lock (m_UserCache) m_UserCache[id] = user; - //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); } //public void AddUser(UUID uuid, string userData) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index ab6be50..c7244c8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -49,6 +49,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private IInventoryService m_InventoryService; + private Scene m_Scene; + + private IUserManagement m_UserManager; + private IUserManagement UserManager + { + get + { + if (m_UserManager == null) + { + m_UserManager = m_Scene.RequestModuleInterface(); + } + return m_UserManager; + } + } + private bool m_Enabled = false; public Type ReplaceableInterface @@ -115,6 +130,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return; scene.RegisterModuleInterface(this); + + if (m_Scene == null) + m_Scene = scene; } public void RemoveRegion(Scene scene) @@ -163,7 +181,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory public InventoryCollection GetFolderContent(UUID userID, UUID folderID) { - return m_InventoryService.GetFolderContent(userID, folderID); + InventoryCollection invCol = m_InventoryService.GetFolderContent(userID, folderID); + if (UserManager != null) + foreach (InventoryItemBase item in invCol.Items) + UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + + return invCol; } public List GetFolderItems(UUID userID, UUID folderID) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index 17d80c7..9213132 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -47,9 +47,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private bool m_Enabled = false; private bool m_Initialized = false; -// private Scene m_Scene; + private Scene m_Scene; private InventoryServicesConnector m_RemoteConnector; + private IUserManagement m_UserManager; + private IUserManagement UserManager + { + get + { + if (m_UserManager == null) + { + m_UserManager = m_Scene.RequestModuleInterface(); + } + return m_UserManager; + } + } + + public Type ReplaceableInterface { get { return null; } @@ -116,6 +130,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory scene.RegisterModuleInterface(this); m_cache.AddRegion(scene); + + if (m_Scene == null) + m_Scene = scene; } public void RemoveRegion(Scene scene) @@ -186,7 +203,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory UUID sessionID = GetSessionID(userID); try { - return m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID); + InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID.ToString(), folderID, sessionID); + foreach (InventoryItemBase item in invCol.Items) + UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); + return invCol; } catch (Exception e) { diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index b7fa799..3238a81 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -269,7 +269,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (!ResolveUserUuid(part.CreatorID)) part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; } - UserManager.AddUser(part.CreatorID, part.CreatorData); + if (UserManager != null) + UserManager.AddUser(part.CreatorID, part.CreatorData); if (!ResolveUserUuid(part.OwnerID)) part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -293,10 +294,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver { kvp.Value.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; } - if (!ResolveUserUuid(kvp.Value.CreatorID)) + if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty) { - kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; + if (!ResolveUserUuid(kvp.Value.CreatorID)) + kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; } + if (UserManager != null) + UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); } } } diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index c06ccb2..568ba19 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -189,6 +189,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell InventoryItemBase item = new InventoryItemBase(); item.CreatorId = part.CreatorID.ToString(); + item.CreatorData = part.CreatorData; item.ID = UUID.Random(); item.Owner = remoteClient.AgentId; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4cc797b..a29b7f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -426,6 +426,7 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase itemCopy = new InventoryItemBase(); itemCopy.Owner = recipient; itemCopy.CreatorId = item.CreatorId; + itemCopy.CreatorData = item.CreatorData; itemCopy.ID = UUID.Random(); itemCopy.AssetID = item.AssetID; itemCopy.Description = item.Description; @@ -699,13 +700,13 @@ namespace OpenSim.Region.Framework.Scenes if (remoteClient.AgentId == oldAgentID) { CreateNewInventoryItem( - remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, + remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); } else { CreateNewInventoryItem( - remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, + remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); } } @@ -755,11 +756,11 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, + private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) { CreateNewInventoryItem( - remoteClient, creatorID, folderID, name, flags, callbackID, asset, invType, + remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); } @@ -774,12 +775,13 @@ namespace OpenSim.Region.Framework.Scenes /// /// private void CreateNewInventoryItem( - IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, + IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) { InventoryItemBase item = new InventoryItemBase(); item.Owner = remoteClient.AgentId; item.CreatorId = creatorID; + item.CreatorData = creatorData; item.ID = UUID.Random(); item.AssetID = asset.FullID; item.Description = asset.Description; @@ -859,7 +861,7 @@ namespace OpenSim.Region.Framework.Scenes AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId); AssetService.Store(asset); - CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); + CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); } else { @@ -901,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes asset.Description = description; CreateNewInventoryItem( - remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, + remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); } @@ -1025,6 +1027,7 @@ namespace OpenSim.Region.Framework.Scenes agentItem.ID = UUID.Random(); agentItem.CreatorId = taskItem.CreatorID.ToString(); + agentItem.CreatorData = taskItem.CreatorData; agentItem.Owner = destAgent; agentItem.AssetID = taskItem.AssetID; agentItem.Description = taskItem.Description; @@ -1226,6 +1229,7 @@ namespace OpenSim.Region.Framework.Scenes destTaskItem.ItemID = UUID.Random(); destTaskItem.CreatorID = srcTaskItem.CreatorID; + destTaskItem.CreatorData = srcTaskItem.CreatorData; destTaskItem.AssetID = srcTaskItem.AssetID; destTaskItem.GroupID = destPart.GroupID; destTaskItem.OwnerID = destPart.OwnerID; @@ -1638,6 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes destTaskItem.ItemID = UUID.Random(); destTaskItem.CreatorID = srcTaskItem.CreatorID; + destTaskItem.CreatorData = srcTaskItem.CreatorData; destTaskItem.AssetID = srcTaskItem.AssetID; destTaskItem.GroupID = destPart.GroupID; destTaskItem.OwnerID = destPart.OwnerID; @@ -1844,6 +1849,7 @@ namespace OpenSim.Region.Framework.Scenes InventoryItemBase item = new InventoryItemBase(); item.CreatorId = grp.RootPart.CreatorID.ToString(); + item.CreatorData = grp.RootPart.CreatorData; item.Owner = remoteClient.AgentId; item.ID = UUID.Random(); item.AssetID = asset.FullID; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6d5a53a..2155e26 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -449,12 +449,17 @@ namespace OpenSim.Region.Framework.Scenes } } - public string CreatorData + public string CreatorData // = ; { get { return m_creatorData; } set { m_creatorData = value; } } + /// + /// Used by the DB layer to retrieve / store the entire user identification. + /// The identification can either be a simple UUID or a string of the form + /// uuid[;profile_url[;name]] + /// public string CreatorIdentification { get diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index fceeafa..9cf5a39 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -331,6 +331,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); + m_TaskInventoryXmlProcessors.Add("CreatorData", ProcessTICreatorData); m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); @@ -707,6 +708,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization item.CreatorID = ReadUUID(reader, "CreatorID"); } + private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) + { + item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); + } + private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) { item.Description = reader.ReadElementContentAsString("Description", String.Empty); @@ -1102,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "FolderID", sop.FolderID, options); writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); - WriteTaskInventory(writer, sop.TaskInventory, options); + WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene); WriteUUID(writer, "UUID", sop.UUID, options); writer.WriteElementString("LocalId", sop.LocalId.ToString()); @@ -1226,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString(name, flagsStr); } - static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) { if (tinv.Count > 0) // otherwise skip this { @@ -1239,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteUUID(writer, "AssetID", item.AssetID, options); writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); writer.WriteElementString("CreationDate", item.CreationDate.ToString()); + + WriteUUID(writer, "CreatorID", item.CreatorID, options); + + if (item.CreatorData != null && item.CreatorData != string.Empty) + writer.WriteElementString("CreatorData", item.CreatorData); + else if (options.ContainsKey("profile")) + { + if (m_UserManagement == null) + m_UserManagement = scene.RequestModuleInterface(); + string name = m_UserManagement.GetUserName(item.CreatorID); + writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); + } + writer.WriteElementString("Description", item.Description); writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); writer.WriteElementString("Flags", item.Flags.ToString()); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index ac6a3ab..23ae5b4 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -601,6 +601,7 @@ namespace OpenSim.Server.Handlers.Asset ret["BasePermissions"] = item.BasePermissions.ToString(); ret["CreationDate"] = item.CreationDate.ToString(); ret["CreatorId"] = item.CreatorId.ToString(); + ret["CreatorData"] = item.CreatorData.ToString(); ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); ret["Description"] = item.Description.ToString(); ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); @@ -646,6 +647,7 @@ namespace OpenSim.Server.Handlers.Asset item.InvType = int.Parse(data["InvType"].ToString()); item.Folder = new UUID(data["Folder"].ToString()); item.CreatorId = data["CreatorId"].ToString(); + item.CreatorData = data["CreatorData"].ToString(); item.Description = data["Description"].ToString(); item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 403ee15..88fbda3 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -312,6 +312,7 @@ namespace OpenSim.Services.Connectors { "InvType", item.InvType.ToString() }, { "Folder", item.Folder.ToString() }, { "CreatorId", item.CreatorId.ToString() }, + { "CreatorData", item.CreatorData.ToString() }, { "Description", item.Description.ToString() }, { "NextPermissions", item.NextPermissions.ToString() }, { "CurrentPermissions", item.CurrentPermissions.ToString() }, @@ -344,6 +345,7 @@ namespace OpenSim.Services.Connectors { "InvType", item.InvType.ToString() }, { "Folder", item.Folder.ToString() }, { "CreatorId", item.CreatorId.ToString() }, + { "CreatorData", item.CreatorData.ToString() }, { "Description", item.Description.ToString() }, { "NextPermissions", item.NextPermissions.ToString() }, { "CurrentPermissions", item.CurrentPermissions.ToString() }, @@ -556,6 +558,7 @@ namespace OpenSim.Services.Connectors item.InvType = int.Parse(data["InvType"].ToString()); item.Folder = new UUID(data["Folder"].ToString()); item.CreatorId = data["CreatorId"].ToString(); + item.CreatorData = data["CreatorData"].ToString(); item.Description = data["Description"].ToString(); item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 21ad4ab..61f3fbe 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -612,6 +612,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", item.Name }, { "Description", item.Description }, { "CreatorID", item.CreatorId }, + { "CreatorData", item.CreatorData }, { "ContentType", invContentType }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; @@ -776,6 +777,7 @@ namespace OpenSim.Services.Connectors.SimianGrid invItem.AssetType = SLUtil.ContentTypeToSLAssetType(item["ContentType"].AsString()); invItem.CreationDate = item["CreationDate"].AsInteger(); invItem.CreatorId = item["CreatorID"].AsString(); + invItem.CreatorData = item["CreatorData"].AsString(); invItem.CreatorIdAsUuid = item["CreatorID"].AsUUID(); invItem.Description = item["Description"].AsString(); invItem.Folder = item["ParentID"].AsUUID(); diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index fb395ec..e602412 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -524,7 +524,7 @@ namespace OpenSim.Services.InventoryService newItem.ID = item.inventoryID; newItem.InvType = item.invType; newItem.Folder = item.parentFolderID; - newItem.CreatorId = item.creatorID; + newItem.CreatorIdentification = item.creatorID; newItem.Description = item.inventoryDescription; newItem.NextPermissions = (uint)item.inventoryNextPermissions; newItem.CurrentPermissions = (uint)item.inventoryCurrentPermissions; @@ -555,7 +555,7 @@ namespace OpenSim.Services.InventoryService newItem.inventoryID = item.ID; newItem.invType = item.InvType; newItem.parentFolderID = item.Folder; - newItem.creatorID = item.CreatorId; + newItem.creatorID = item.CreatorIdentification; newItem.inventoryDescription = item.Description; newItem.inventoryNextPermissions = (int)item.NextPermissions; newItem.inventoryCurrentPermissions = (int)item.CurrentPermissions; -- cgit v1.1