Allow default permissions from the viewer to be applied to uploaded objects.

Make inventory items reflect coorect permissions immediately unstead of after relog
LSLKeyTest
Melanie Thielker 2016-04-29 21:23:32 +02:00
parent bedebf9498
commit d42de53dda
6 changed files with 74 additions and 23 deletions

View File

@ -40,6 +40,10 @@ namespace OpenSim.Framework.Capabilities
public string state = String.Empty;
public LLSDAssetUploadError error = null;
//public bool success = false;
public int new_next_owner_mask = 0;
public int new_group_mask = 0;
public int new_everyone_mask = 0;
public int inventory_item_flags = 0;
public LLSDAssetUploadComplete()
{

View File

@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
byte[] data, string inventoryType, string assetType,
int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
bool IsAtestUpload, ref string error);
bool IsAtestUpload, ref string error, ref int nextOwnerMask, ref int groupMask, ref int everyoneMask);
public delegate UUID UpdateItem(UUID itemID, byte[] data);
@ -666,7 +666,8 @@ namespace OpenSim.Region.ClientStack.Linden
AssetUploader uploader =
new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload);
texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload,
llsdRequest.next_owner_mask, llsdRequest.group_mask, llsdRequest.everyone_mask);
m_HostCapsObj.HttpListener.AddStreamHandler(
new BinaryStreamHandler(
@ -713,9 +714,9 @@ namespace OpenSim.Region.ClientStack.Linden
UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
string assetType, int cost,
UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
bool IsAtestUpload, ref string error)
bool IsAtestUpload, ref string error,
ref int nextOwnerMask, ref int groupMask, ref int everyoneMask)
{
lock (m_ModelCost)
m_FileAgentInventoryState = FileAgentInventoryState.processUpload;
@ -1081,6 +1082,12 @@ namespace OpenSim.Region.ClientStack.Linden
{
prim.BaseMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
prim.OwnerMask = (uint)PermissionMask.All | (uint)PermissionMask.Export;
prim.GroupMask = prim.BaseMask & (uint)groupMask;
prim.EveryoneMask = prim.BaseMask & (uint)everyoneMask;
prim.NextOwnerMask = prim.BaseMask & (uint)nextOwnerMask;
// If the viewer gives us bogus permissions, revert to the SL
// default of transfer only.
if ((prim.NextOwnerMask & (uint)PermissionMask.All) == 0)
prim.NextOwnerMask = (uint)PermissionMask.Transfer;
}
@ -1191,6 +1198,7 @@ namespace OpenSim.Region.ClientStack.Linden
{
item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify);
item.GroupPermissions = 0;
item.EveryOnePermissions = 0;
item.NextPermissions = 0;
}
@ -1198,12 +1206,19 @@ namespace OpenSim.Region.ClientStack.Linden
{
item.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
item.CurrentPermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
item.EveryOnePermissions = 0;
item.GroupPermissions = item.BasePermissions & (uint)groupMask;
item.EveryOnePermissions = item.BasePermissions & (uint)everyoneMask;
item.NextPermissions = item.BasePermissions & (uint)nextOwnerMask;
if ((item.NextPermissions & (uint)PermissionMask.All) == 0)
item.NextPermissions = (uint)PermissionMask.Transfer;
}
item.CreationDate = Util.UnixTimeSinceEpoch();
everyoneMask = (int)item.EveryOnePermissions;
groupMask = (int)item.GroupPermissions;
nextOwnerMask = (int)item.NextPermissions;
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
if (AddNewInventoryItem != null)
@ -1593,11 +1608,16 @@ namespace OpenSim.Region.ClientStack.Linden
private int m_nreqinstances;
private bool m_IsAtestUpload;
private int m_nextOwnerMask;
private int m_groupMask;
private int m_everyoneMask;
public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
UUID parentFolderID, string invType, string assetType, string path,
IHttpServer httpServer, bool dumpAssetsToFile,
int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
bool IsAtestUpload)
bool IsAtestUpload, int nextOwnerMask, int groupMask, int everyoneMask)
{
m_assetName = assetName;
m_assetDes = description;
@ -1621,6 +1641,10 @@ namespace OpenSim.Region.ClientStack.Linden
m_timeoutTimer.Interval = 120000;
m_timeoutTimer.AutoReset = false;
m_timeoutTimer.Start();
m_nextOwnerMask = nextOwnerMask;
m_groupMask = groupMask;
m_everyoneMask = everyoneMask;
}
/// <summary>
@ -1661,8 +1685,13 @@ namespace OpenSim.Region.ClientStack.Linden
{
handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,
m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
ref m_error);
ref m_error, ref m_nextOwnerMask, ref m_groupMask, ref m_everyoneMask);
}
uploadComplete.new_next_owner_mask = m_nextOwnerMask;
uploadComplete.new_group_mask = m_groupMask;
uploadComplete.new_everyone_mask = m_everyoneMask;
if (m_IsAtestUpload)
{
LLSDAssetUploadError resperror = new LLSDAssetUploadError();

View File

@ -429,7 +429,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
m_transactions.RemoveXferUploader(m_transactionID);
m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(ourClient.AgentId, (AssetType)type, m_asset.FullID, m_asset.Name, 0);
m_Scene.EventManager.TriggerOnNewInventoryItemUploadComplete(item, 0);
}
/// <summary>

View File

@ -209,15 +209,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
}
public void PostInventoryAsset(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel)
public void PostInventoryAsset(InventoryItemBase item, int userlevel)
{
if (type == AssetType.Link)
if (item.AssetType == (int)AssetType.Link)
return;
string userAssetServer = string.Empty;
if (IsForeignUser(avatarID, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
if (IsForeignUser(item.Owner, out userAssetServer) && userAssetServer != string.Empty && m_OutboundPermission)
{
m_assMapper.Post(assetID, avatarID, userAssetServer);
m_assMapper.Post(item.AssetID, item.Owner, userAssetServer);
}
}
@ -248,7 +248,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
UUID newAssetID = base.CapsUpdateInventoryItemAsset(remoteClient, itemID, data);
PostInventoryAsset(remoteClient.AgentId, AssetType.Unknown, newAssetID, "", 0);
// We need to construct this here to satisfy the calling convention.
// Better this in two places than five formal params in all others.
InventoryItemBase item = new InventoryItemBase();
item.Owner = remoteClient.AgentId;
item.AssetType = (int)AssetType.Unknown;
item.AssetID = newAssetID;
item.Name = String.Empty;
PostInventoryAsset(item, 0);
return newAssetID;
}
@ -260,7 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
if (base.UpdateInventoryItemAsset(ownerID, item, asset))
{
PostInventoryAsset(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
PostInventoryAsset(item, 0);
return true;
}
@ -273,10 +281,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected override void ExportAsset(UUID agentID, UUID assetID)
{
if (!assetID.Equals(UUID.Zero))
PostInventoryAsset(agentID, AssetType.Unknown, assetID, "", 0);
{
InventoryItemBase item = new InventoryItemBase();
item.Owner = agentID;
item.AssetType = (int)AssetType.Unknown;
item.AssetID = assetID;
item.Name = String.Empty;
PostInventoryAsset(item, 0);
}
else
{
m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
}
}
///
/// RezObject

View File

@ -748,7 +748,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnIncomingSceneObjectDelegate OnIncomingSceneObject;
public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so);
public delegate void NewInventoryItemUploadComplete(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel);
public delegate void NewInventoryItemUploadComplete(InventoryItemBase item, int userlevel);
public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete;
@ -2262,7 +2262,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, AssetType type, UUID AssetID, String AssetName, int userlevel)
public void TriggerOnNewInventoryItemUploadComplete(InventoryItemBase item, int userlevel)
{
NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete;
if (handlerNewInventoryItemUpdateComplete != null)
@ -2271,7 +2271,7 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
d(agentID, type, AssetID, AssetName, userlevel);
d(item, userlevel);
}
catch (Exception e)
{

View File

@ -149,7 +149,7 @@ namespace OpenSim.Region.Framework.Scenes
userlevel = 1;
}
if (trigger)
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
EventManager.TriggerOnNewInventoryItemUploadComplete(item, userlevel);
return true;
}
@ -191,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes
userlevel = 1;
}
if (trigger)
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel);
EventManager.TriggerOnNewInventoryItemUploadComplete(item, userlevel);
if (originalFolder != UUID.Zero)
{