Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for identifying user profiles or supplying a simple name if no profile is available.
Exemple #1
0
        /// <summary>
        ///     Load an item from the archive
        /// </summary>
        /// <param name="data">The raw item data</param>
        /// <param name="loadFolder"> </param>
        protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
        {
            InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);


            UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_accountService);

            if (UUID.Zero != ospResolvedId)
            {
                item.CreatorIdAsUuid = ospResolvedId;

                // Don't preserve the OSPA in the creator id (which actually gets persisted to the
                // database).  Instead, replace with the UUID that we found.
                item.CreatorId = ospResolvedId.ToString();

                item.CreatorData = string.Empty;
            }
            else if (string.IsNullOrEmpty(item.CreatorData))
            {
                item.CreatorId       = m_userInfo.PrincipalID.ToString();
                item.CreatorIdAsUuid = new UUID(item.CreatorId);
            }

            // Don't use the item ID that's in the file, this could be a local user's folder
            //item.ID = UUID.Random();
            item.Owner = m_userInfo.PrincipalID;


            // Record the creator id for the item's asset so that we can use it later, if necessary, when the asset
            // is loaded.
            // FIXME: This relies on the items coming before the assets in the TAR file.  Need to create stronger
            // checks for this, and maybe even an external tool for creating OARs which enforces this, rather than
            // relying on native tar tools.
            m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid;

            // Reset folder ID to the one in which we want to load it
            item.Folder = loadFolder.ID;

            itemsSavedOff.Add(item);

            return(item);
        }
Exemple #2
0
        protected void SaveInvItem(InventoryItemBase inventoryItem, string path)
        {
            // Check For Permissions Filter Flags
            if (!CanUserArchiveObject(m_userInfo.PrincipalID, inventoryItem))
            {
                MainConsole.Instance.InfoFormat(
                    "[Inventory Archiver]: Insufficient permissions, skipping inventory item {0} {1} at {2}",
                    inventoryItem.Name, inventoryItem.ID, path);

                // Count Items Excluded
                CountFiltered++;

                return;
            }

            string filename = path + CreateArchiveItemName(inventoryItem);

            // Record the creator of this item for user record purposes (which might go away soon)
            m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;

            InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();

            saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_accountService);

            string serialization = UserInventoryItemSerializer.Serialize(saveItem);

            m_archiveWriter.WriteFile(filename, serialization);

            //        m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType) saveItem.AssetType, m_assetUuids);
            AssetType itemAssetType = (AssetType)inventoryItem.AssetType;

            // Don't chase down link asset items as they actually point to their target item IDs rather than an asset
            if (m_saveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
            {
                m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids);
            }
        }