From f0895028e96e39ca179cad8c103042397ad870e5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 23 Jul 2011 02:13:11 +0100 Subject: Remove manually permissions settings on all current library items so that they use the defaults instead. Some items had completely wrong permissions - this is easier than correcting them all. The ability to set permissions in xml is retained since there are use cases for this (e.g. to create no-mod library scripts) --- OpenSim/Framework/InventoryFolderImpl.cs | 8 +++++++- .../Framework/InventoryAccess/InventoryAccessModule.cs | 4 ++++ OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs | 8 +++++++- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 ++++- OpenSim/Services/InventoryService/LibraryService.cs | 8 ++++---- 5 files changed, 26 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/InventoryFolderImpl.cs b/OpenSim/Framework/InventoryFolderImpl.cs index 29c7682..139776b 100644 --- a/OpenSim/Framework/InventoryFolderImpl.cs +++ b/OpenSim/Framework/InventoryFolderImpl.cs @@ -27,13 +27,15 @@ using System; using System.Collections.Generic; +using System.Reflection; +using log4net; using OpenMetaverse; namespace OpenSim.Framework { public class InventoryFolderImpl : InventoryFolderBase { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly string PATH_DELIMITER = "/"; @@ -402,6 +404,10 @@ namespace OpenSim.Framework { foreach (InventoryItemBase item in Items.Values) { +// m_log.DebugFormat( +// "[INVENTORY FOLDER IMPL]: Returning item {0} {1}, OwnerPermissions {2:X}", +// item.Name, item.ID, item.CurrentPermissions); + itemList.Add(item); } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index b714f2b..4933147 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -984,11 +984,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public virtual bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) { InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); + if (assetRequestItem == null) { ILibraryService lib = m_Scene.RequestModuleInterface(); + if (lib != null) assetRequestItem = lib.LibraryRootFolder.FindItem(itemID); + if (assetRequestItem == null) return false; } @@ -1019,6 +1022,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess m_log.WarnFormat( "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}", Name, requestID, itemID, assetRequestItem.AssetID); + return false; } diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index d570608..2ef4457 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -185,6 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false); archread.Execute(); } + foreach (InventoryNodeBase node in nodes) FixPerms(node); } @@ -197,18 +198,23 @@ namespace OpenSim.Region.CoreModules.Framework.Library archread.Close(); } } - } private void FixPerms(InventoryNodeBase node) { + m_log.DebugFormat("[LIBRARY MODULE]: Fixing perms for {0} {1}", node.Name, node.ID); + if (node is InventoryItemBase) { InventoryItemBase item = (InventoryItemBase)node; +// item.BasePermissions = (uint)PermissionMask.All; item.BasePermissions = 0x7FFFFFFF; item.EveryOnePermissions = 0x7FFFFFFF; item.CurrentPermissions = 0x7FFFFFFF; item.NextPermissions = 0x7FFFFFFF; +// item.EveryOnePermissions = (uint)PermissionMask.Copy; +// item.CurrentPermissions = (uint)PermissionMask.None; +// item.NextPermissions = (uint)PermissionMask.All; } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 30421d4..afc1a4f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -724,7 +724,10 @@ namespace OpenSim.Region.Framework.Scenes newName = item.Name; } - if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner)) + if (remoteClient.AgentId == oldAgentID + || (LibraryService != null + && LibraryService.LibraryRootFolder != null + && oldAgentID == LibraryService.LibraryRootFolder.Owner)) { CreateNewInventoryItem( remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, diff --git a/OpenSim/Services/InventoryService/LibraryService.cs b/OpenSim/Services/InventoryService/LibraryService.cs index 383f311..2e9d2b1 100644 --- a/OpenSim/Services/InventoryService/LibraryService.cs +++ b/OpenSim/Services/InventoryService/LibraryService.cs @@ -193,10 +193,10 @@ namespace OpenSim.Services.InventoryService item.Description = config.GetString("description", item.Name); item.InvType = config.GetInt("inventoryType", 0); item.AssetType = config.GetInt("assetType", item.InvType); - item.CurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); - item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); - item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); - item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); + item.CurrentPermissions = (uint)config.GetLong("currentPermissions", (uint)PermissionMask.All); + item.NextPermissions = (uint)config.GetLong("nextPermissions", (uint)PermissionMask.All); + item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", (uint)PermissionMask.All); + item.BasePermissions = (uint)config.GetLong("basePermissions", (uint)PermissionMask.All); item.Flags = (uint)config.GetInt("flags", 0); if (libraryFolders.ContainsKey(item.Folder)) -- cgit v1.1