From a1aed3a4436c6b471fb134c91340fbfb256834cf Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 8 Jan 2011 02:16:19 +0000 Subject: [PATCH] give default items much more sensible permissions and owner/creatorship --- .../InventoryService/LibraryService.cs | 18 ++++---- .../InventoryService/XInventoryService.cs | 42 ++++++++++++++++--- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/OpenSim/Services/InventoryService/LibraryService.cs b/OpenSim/Services/InventoryService/LibraryService.cs index 383f311fdf..f4d68f961b 100644 --- a/OpenSim/Services/InventoryService/LibraryService.cs +++ b/OpenSim/Services/InventoryService/LibraryService.cs @@ -56,7 +56,11 @@ namespace OpenSim.Services.InventoryService get { return m_LibraryRootFolder; } } - private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); + public static UUID LibOwner + { + get { return s_libOwner; } + } + protected static UUID s_libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); /// /// Holds the root library folder and all its descendents. This is really only used during inventory @@ -81,7 +85,7 @@ namespace OpenSim.Services.InventoryService m_log.Debug("[LIBRARY]: Starting library service..."); m_LibraryRootFolder = new InventoryFolderImpl(); - m_LibraryRootFolder.Owner = libOwner; + m_LibraryRootFolder.Owner = LibOwner; m_LibraryRootFolder.ID = new UUID("00000112-000f-0000-0000-000100bba000"); m_LibraryRootFolder.Name = pLibName; m_LibraryRootFolder.ParentID = UUID.Zero; @@ -97,8 +101,8 @@ namespace OpenSim.Services.InventoryService int assetType, int invType, UUID parentFolderID) { InventoryItemBase item = new InventoryItemBase(); - item.Owner = libOwner; - item.CreatorId = libOwner.ToString(); + item.Owner = LibOwner; + item.CreatorId = LibOwner.ToString(); item.ID = inventoryID; item.AssetID = assetID; item.Description = description; @@ -157,7 +161,7 @@ namespace OpenSim.Services.InventoryService folderInfo.ParentID = new UUID(config.GetString("parentFolderID", m_LibraryRootFolder.ID.ToString())); folderInfo.Type = (short)config.GetInt("type", 8); - folderInfo.Owner = libOwner; + folderInfo.Owner = LibOwner; folderInfo.Version = 1; if (libraryFolders.ContainsKey(folderInfo.ParentID)) @@ -184,8 +188,8 @@ namespace OpenSim.Services.InventoryService private void ReadItemFromConfig(IConfig config, string path) { InventoryItemBase item = new InventoryItemBase(); - item.Owner = libOwner; - item.CreatorId = libOwner.ToString(); + item.Owner = LibOwner; + item.CreatorId = LibOwner.ToString(); item.ID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString())); item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7fc1327ade..024833d01a 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -149,7 +149,12 @@ namespace OpenSim.Services.InventoryService defaultShape.ID = AvatarWearable.DEFAULT_BODY_ITEM; defaultShape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET; defaultShape.Folder = bodypartFolder.ID; - defaultShape.CreatorId = UUID.Zero.ToString(); + defaultShape.CreatorId = LibraryService.LibOwner.ToString(); + defaultShape.Owner = principalID; + defaultShape.BasePermissions = (uint)PermissionMask.All; + defaultShape.CurrentPermissions = (uint)PermissionMask.All; + defaultShape.EveryOnePermissions = (uint)PermissionMask.None; + defaultShape.NextPermissions = (uint)PermissionMask.All; AddItem(defaultShape); InventoryItemBase defaultSkin = new InventoryItemBase(); @@ -161,7 +166,12 @@ namespace OpenSim.Services.InventoryService defaultSkin.ID = AvatarWearable.DEFAULT_SKIN_ITEM; defaultSkin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET; defaultSkin.Folder = bodypartFolder.ID; - defaultSkin.CreatorId = UUID.Zero.ToString(); + defaultSkin.CreatorId = LibraryService.LibOwner.ToString(); + defaultSkin.Owner = principalID; + defaultSkin.BasePermissions = (uint)PermissionMask.All; + defaultSkin.CurrentPermissions = (uint)PermissionMask.All; + defaultSkin.EveryOnePermissions = (uint)PermissionMask.None; + defaultSkin.NextPermissions = (uint)PermissionMask.All; AddItem(defaultSkin); InventoryItemBase defaultHair = new InventoryItemBase(); @@ -173,7 +183,12 @@ namespace OpenSim.Services.InventoryService defaultHair.ID = AvatarWearable.DEFAULT_HAIR_ITEM; defaultHair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET; defaultHair.Folder = bodypartFolder.ID; - defaultHair.CreatorId = UUID.Zero.ToString(); + defaultHair.CreatorId = LibraryService.LibOwner.ToString(); + defaultHair.Owner = principalID; + defaultHair.BasePermissions = (uint)PermissionMask.All; + defaultHair.CurrentPermissions = (uint)PermissionMask.All; + defaultHair.EveryOnePermissions = (uint)PermissionMask.None; + defaultHair.NextPermissions = (uint)PermissionMask.All; AddItem(defaultHair); InventoryItemBase defaultEyes = new InventoryItemBase(); @@ -185,7 +200,12 @@ namespace OpenSim.Services.InventoryService defaultEyes.ID = AvatarWearable.DEFAULT_EYES_ITEM; defaultEyes.AssetID = AvatarWearable.DEFAULT_EYES_ASSET; defaultEyes.Folder = bodypartFolder.ID; - defaultEyes.CreatorId = UUID.Zero.ToString(); + defaultEyes.CreatorId = LibraryService.LibOwner.ToString(); + defaultEyes.Owner = principalID; + defaultEyes.BasePermissions = (uint)PermissionMask.All; + defaultEyes.CurrentPermissions = (uint)PermissionMask.All; + defaultEyes.EveryOnePermissions = (uint)PermissionMask.None; + defaultEyes.NextPermissions = (uint)PermissionMask.All; AddItem(defaultEyes); // Default minimum clothes for viewer 2 non-naked appearance @@ -198,7 +218,12 @@ namespace OpenSim.Services.InventoryService defaultShirt.ID = AvatarWearable.DEFAULT_SHIRT_ITEM; defaultShirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET; defaultShirt.Folder = clothingFolder.ID; - defaultShirt.CreatorId = UUID.Zero.ToString(); + defaultShirt.CreatorId = LibraryService.LibOwner.ToString(); + defaultShirt.Owner = principalID; + defaultShirt.BasePermissions = (uint)PermissionMask.All; + defaultShirt.CurrentPermissions = (uint)PermissionMask.All; + defaultShirt.EveryOnePermissions = (uint)PermissionMask.None; + defaultShirt.NextPermissions = (uint)PermissionMask.All; AddItem(defaultShirt); InventoryItemBase defaultPants = new InventoryItemBase(); @@ -210,7 +235,12 @@ namespace OpenSim.Services.InventoryService defaultPants.ID = AvatarWearable.DEFAULT_PANTS_ITEM; defaultPants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET; defaultPants.Folder = clothingFolder.ID; - defaultPants.CreatorId = UUID.Zero.ToString(); + defaultPants.CreatorId = LibraryService.LibOwner.ToString(); + defaultPants.Owner = principalID; + defaultPants.BasePermissions = (uint)PermissionMask.All; + defaultPants.CurrentPermissions = (uint)PermissionMask.All; + defaultPants.EveryOnePermissions = (uint)PermissionMask.None; + defaultPants.NextPermissions = (uint)PermissionMask.All; AddItem(defaultPants); return result;