From 59ed89769aa292196f99affe0a99a758e63a538a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 29 Apr 2016 22:36:56 +0200
Subject: Apply user specified default perms across the board, to items
uploaded as well as items created and to rezzed prims in world. This
effectively removes the concept of "default permissions" from OpenSim because
all known modern viewers set the permissions flags on login. Ancient
abandoned viewers will now default to the SL defaults.
---
OpenSim/Framework/IClientAPI.cs | 2 +-
.../InventoryAccess/InventoryAccessModule.cs | 9 ++++---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 28 +---------------------
OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
.../AgentPreferencesServerPostHandler.cs | 3 ++-
.../Interfaces/IAgentPreferencesService.cs | 2 +-
.../UserAccountService/AgentPreferencesService.cs | 2 +-
8 files changed, 25 insertions(+), 35 deletions(-)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 696b0ef..c949c04 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -242,7 +242,7 @@ namespace OpenSim.Framework
public delegate void CreateNewInventoryItem(
IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name,
- sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask, int creationDate);
+ sbyte invType, sbyte type, byte wearableType, uint everyoneMask, int creationDate);
public delegate void LinkInventoryItem(
IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name,
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 49a708b..d4a929c 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
///
public void CreateNewInventoryItem(IClientAPI remoteClient, UUID transactionID, UUID folderID,
uint callbackID, string description, string name, sbyte invType,
- sbyte assetType,
- byte wearableType, uint nextOwnerMask, int creationDate)
+ sbyte assetType, byte wearableType,
+ uint nextOwnerMask, int creationDate)
{
m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}, transactionID {2}", name,
folderID, transactionID);
@@ -220,7 +220,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
m_Scene.AssetService.Store(asset);
m_Scene.CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
- name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
+ name, description, 0, callbackID, asset.FullID, asset.Type, invType,
+ (uint)PermissionMask.All | (uint)PermissionMask.Export, // Base
+ (uint)PermissionMask.All | (uint)PermissionMask.Export, // Current
+ 0, nextOwnerMask, 0, creationDate, false); // Data from viewer
}
else
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index a28737e..b77b860 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -980,32 +980,6 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Create a new inventory item.
- ///
- /// Client creating this inventory item.
- ///
- ///
- /// UUID of folder in which this item should be placed.
- /// Item name.
- /// Item description.
- /// Item flags
- /// Generated by the client.
- /// Asset to which this item refers.
- /// Type of inventory item.
- /// Next owner pemrissions mask.
- /// Unix timestamp at which this item was created.
- public void CreateNewInventoryItem(
- IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
- string name, string description, uint flags, uint callbackID,
- UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate)
- {
- CreateNewInventoryItem(
- remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType,
- (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0,
- creationDate, true);
- }
-
- ///
/// Create a new Inventory Item
///
/// Client creating this inventory item.
@@ -1024,7 +998,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Next owner pemrissions mask.
/// Group permissions mask.
/// Unix timestamp at which this item was created.
- private void CreateNewInventoryItem(
+ public void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 058b6f6..e829b15 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2566,6 +2566,18 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
+
+ if (AgentPreferencesService != null) // This will override the brave new full perm world!
+ {
+ AgentPrefs prefs = AgentPreferencesService.GetAgentPreferences(ownerID);
+ // Only apply user selected prefs if the user set them
+ if (prefs.PermNextOwner != 0)
+ {
+ sceneObject.RootPart.GroupMask = (uint)prefs.PermGroup;
+ sceneObject.RootPart.EveryoneMask = (uint)prefs.PermEveryone;
+ sceneObject.RootPart.NextOwnerMask = (uint)prefs.PermNextOwner;
+ }
+ }
}
if (UserManagementModule != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index c17961b..7d95c8d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -482,7 +482,7 @@ namespace OpenSim.Region.Framework.Scenes
private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export);
private uint _groupMask = (uint)PermissionMask.None;
private uint _everyoneMask = (uint)PermissionMask.None;
- private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
+ private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Transfer);
private PrimFlags _flags = PrimFlags.None;
private DateTime m_expires;
private DateTime m_rezzed;
diff --git a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
index 713b755..b1b3c6f 100644
--- a/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/AgentPreferences/AgentPreferencesServerPostHandler.cs
@@ -106,7 +106,8 @@ namespace OpenSim.Server.Handlers.AgentPreferences
return FailureResult();
AgentPrefs prefs = m_AgentPreferencesService.GetAgentPreferences(userID);
Dictionary result = new Dictionary();
- result = prefs.ToKeyValuePairs();
+ if (prefs != null)
+ result = prefs.ToKeyValuePairs();
string xmlString = ServerUtils.BuildXmlResponse(result);
diff --git a/OpenSim/Services/Interfaces/IAgentPreferencesService.cs b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs
index 3b4fda2..ae2c5ac 100644
--- a/OpenSim/Services/Interfaces/IAgentPreferencesService.cs
+++ b/OpenSim/Services/Interfaces/IAgentPreferencesService.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Interfaces
// DefaultObjectPermMasks
public int PermEveryone = 0;
public int PermGroup = 0;
- public int PermNextOwner = 532480;
+ public int PermNextOwner = 0; // Illegal value by design
}
public interface IAgentPreferencesService
diff --git a/OpenSim/Services/UserAccountService/AgentPreferencesService.cs b/OpenSim/Services/UserAccountService/AgentPreferencesService.cs
index 1808ee5..5013152 100644
--- a/OpenSim/Services/UserAccountService/AgentPreferencesService.cs
+++ b/OpenSim/Services/UserAccountService/AgentPreferencesService.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Services.UserAccountService
public AgentPrefs GetAgentPreferences(UUID principalID)
{
AgentPreferencesData d = m_Database.GetPrefs(principalID);
- AgentPrefs prefs = (d == null) ? new AgentPrefs(principalID) : new AgentPrefs(d.Data);
+ AgentPrefs prefs = (d == null) ? null : new AgentPrefs(d.Data);
return prefs;
}
--
cgit v1.1