fix merge
commit
832ca518d7
|
@ -3087,15 +3087,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
private void ApplyNextOwnerPermissions(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
if (item.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
uint perms = item.CurrentPermissions;
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
PermissionsUtil.ApplyFoldedPermissions(item.CurrentPermissions, ref perms);
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
item.CurrentPermissions = perms;
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
item.CurrentPermissions &= item.NextPermissions;
|
item.CurrentPermissions &= item.NextPermissions;
|
||||||
item.BasePermissions &= item.NextPermissions;
|
item.BasePermissions &= item.NextPermissions;
|
||||||
item.EveryOnePermissions &= item.NextPermissions;
|
item.EveryOnePermissions &= item.NextPermissions;
|
||||||
|
|
|
@ -60,9 +60,57 @@ namespace OpenSim.Framework
|
||||||
str += "C";
|
str += "C";
|
||||||
if ((perms & (int)PermissionMask.Transfer) != 0)
|
if ((perms & (int)PermissionMask.Transfer) != 0)
|
||||||
str += "T";
|
str += "T";
|
||||||
|
if ((perms & (int)PermissionMask.Export) != 0)
|
||||||
|
str += "X";
|
||||||
if (str == "")
|
if (str == "")
|
||||||
str = ".";
|
str = ".";
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ApplyFoldedPermissions(uint foldedSourcePerms, ref uint targetPerms)
|
||||||
|
{
|
||||||
|
uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask;
|
||||||
|
if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do
|
||||||
|
return;
|
||||||
|
|
||||||
|
folded <<= (int)PermissionMask.FoldingShift;
|
||||||
|
folded |= ~(uint)PermissionMask.UnfoldedMask;
|
||||||
|
|
||||||
|
uint tmp = targetPerms;
|
||||||
|
tmp &= folded;
|
||||||
|
targetPerms = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not touch MOD
|
||||||
|
public static void ApplyNoModFoldedPermissions(uint foldedSourcePerms, ref uint target)
|
||||||
|
{
|
||||||
|
uint folded = foldedSourcePerms & (uint)PermissionMask.FoldedMask;
|
||||||
|
if(folded == 0 || folded == (uint)PermissionMask.FoldedMask) // invalid we need to ignore, or nothing to do
|
||||||
|
return;
|
||||||
|
|
||||||
|
folded <<= (int)PermissionMask.FoldingShift;
|
||||||
|
folded |= (~(uint)PermissionMask.UnfoldedMask | (uint)PermissionMask.Modify);
|
||||||
|
|
||||||
|
uint tmp = target;
|
||||||
|
tmp &= folded;
|
||||||
|
target = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static uint FixAndFoldPermissions(uint perms)
|
||||||
|
{
|
||||||
|
uint tmp = perms;
|
||||||
|
|
||||||
|
// C & T rule
|
||||||
|
if((tmp & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0)
|
||||||
|
tmp |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
|
// unlock
|
||||||
|
tmp |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
|
tmp &= ~(uint)PermissionMask.FoldedMask;
|
||||||
|
tmp |= ((tmp >> (int)PermissionMask.FoldingShift) & (uint)PermissionMask.FoldedMask);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,8 +191,7 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
m_log.FatalFormat("Fatal error: {0}",
|
m_log.Fatal("Fatal error: " + e.ToString());
|
||||||
(e.Message == null || e.Message == String.Empty) ? "Unknown reason":e.Message );
|
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
FoldedMask = 0x0f,
|
FoldedMask = 0x0f,
|
||||||
|
|
||||||
//
|
FoldingShift = 13 , // number of bit shifts from normal perm to folded or back (same as Transfer shift below)
|
||||||
|
// when doing as a block
|
||||||
|
|
||||||
Transfer = 1 << 13, // 0x02000
|
Transfer = 1 << 13, // 0x02000
|
||||||
Modify = 1 << 14, // 0x04000
|
Modify = 1 << 14, // 0x04000
|
||||||
Copy = 1 << 15, // 0x08000
|
Copy = 1 << 15, // 0x08000
|
||||||
|
@ -90,7 +92,8 @@ namespace OpenSim.Framework
|
||||||
// explicitly given
|
// explicitly given
|
||||||
All = 0x8e000,
|
All = 0x8e000,
|
||||||
AllAndExport = 0x9e000,
|
AllAndExport = 0x9e000,
|
||||||
AllEffective = 0x9e000
|
AllEffective = 0x9e000,
|
||||||
|
UnfoldedMask = 0x1e000
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -237,7 +237,7 @@ namespace OpenSim
|
||||||
string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
|
string permissionModules = Util.GetConfigVarFromSections<string>(Config, "permissionmodules",
|
||||||
new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
|
new string[] { "Startup", "Permissions" }, "DefaultPermissionsModule");
|
||||||
|
|
||||||
m_permsModules = new List<string>(permissionModules.Split(','));
|
m_permsModules = new List<string>(permissionModules.Split(',').Select(m => m.Trim()));
|
||||||
|
|
||||||
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
|
managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
|
||||||
managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
|
managedStatsPassword = startupConfig.GetString("ManagedStatsRemoteFetchPassword", String.Empty);
|
||||||
|
|
|
@ -212,6 +212,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
|
||||||
{
|
{
|
||||||
byte[] data = null;
|
byte[] data = null;
|
||||||
|
uint everyonemask = 0;
|
||||||
|
uint groupmask = 0;
|
||||||
|
|
||||||
if (invType == (sbyte)InventoryType.Landmark && presence != null)
|
if (invType == (sbyte)InventoryType.Landmark && presence != null)
|
||||||
{
|
{
|
||||||
|
@ -220,6 +222,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
data = Encoding.ASCII.GetBytes(strdata);
|
data = Encoding.ASCII.GetBytes(strdata);
|
||||||
name = prefix + name;
|
name = prefix + name;
|
||||||
description += suffix;
|
description += suffix;
|
||||||
|
groupmask = (uint)PermissionMask.AllAndExport;
|
||||||
|
everyonemask = (uint)(PermissionMask.AllAndExport & ~PermissionMask.Modify);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
|
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
|
||||||
|
@ -227,9 +231,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
m_Scene.CreateNewInventoryItem(
|
m_Scene.CreateNewInventoryItem(
|
||||||
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
|
||||||
name, description, 0, callbackID, asset.FullID, asset.Type, invType,
|
name, description, 0, callbackID, asset.FullID, asset.Type, invType,
|
||||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, // Base
|
(uint)PermissionMask.AllAndExport, // Base
|
||||||
(uint)PermissionMask.All | (uint)PermissionMask.Export, // Current
|
(uint)PermissionMask.AllAndExport, // Current
|
||||||
0, nextOwnerMask, 0, creationDate, false); // Data from viewer
|
everyonemask,
|
||||||
|
nextOwnerMask, groupmask, creationDate, false); // Data from viewer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -573,41 +578,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
InventoryItemBase item, SceneObjectGroup so, List<SceneObjectGroup> objsForEffectivePermissions,
|
||||||
IClientAPI remoteClient)
|
IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
|
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export | PermissionMask.FoldedMask);
|
||||||
uint allObjectsNextOwnerPerms = 0x7fffffff;
|
|
||||||
|
|
||||||
// For the porposes of inventory, an object is modify if the prims
|
|
||||||
// are modify. This allows renaming an object that contains no
|
|
||||||
// mod items.
|
|
||||||
foreach (SceneObjectGroup grp in objsForEffectivePermissions)
|
foreach (SceneObjectGroup grp in objsForEffectivePermissions)
|
||||||
{
|
{
|
||||||
uint groupPerms = grp.GetEffectivePermissions(true);
|
effectivePerms &= grp.CurrentAndFoldedNextPermissions();
|
||||||
if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
|
|
||||||
groupPerms |= (uint)PermissionMask.Modify;
|
|
||||||
|
|
||||||
effectivePerms &= groupPerms;
|
|
||||||
}
|
}
|
||||||
effectivePerms |= (uint)PermissionMask.Move;
|
|
||||||
|
|
||||||
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
uint perms = effectivePerms;
|
// apply parts inventory items next owner
|
||||||
uint nextPerms = (perms & 7) << 13;
|
PermissionsUtil.ApplyNoModFoldedPermissions(effectivePerms, ref effectivePerms);
|
||||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
// change to next owner
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
uint basePerms = effectivePerms & so.RootPart.NextOwnerMask;
|
||||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
// fix and update folded
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
basePerms = PermissionsUtil.FixAndFoldPermissions(basePerms);
|
||||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
|
||||||
|
|
||||||
// item.BasePermissions = perms & so.RootPart.NextOwnerMask;
|
item.BasePermissions = basePerms;
|
||||||
|
item.CurrentPermissions = basePerms;
|
||||||
uint nextp = so.RootPart.NextOwnerMask | (uint)PermissionMask.FoldedMask;
|
item.NextPermissions = basePerms & so.RootPart.NextOwnerMask;
|
||||||
item.BasePermissions = perms & nextp;
|
item.EveryOnePermissions = basePerms & so.RootPart.EveryoneMask;
|
||||||
item.CurrentPermissions = item.BasePermissions;
|
item.GroupPermissions = basePerms & so.RootPart.GroupMask;
|
||||||
item.NextPermissions = perms & so.RootPart.NextOwnerMask;
|
|
||||||
item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
|
|
||||||
item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
|
|
||||||
|
|
||||||
// apply next owner perms on rez
|
// apply next owner perms on rez
|
||||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
|
@ -626,7 +617,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
(uint)PermissionMask.Modify |
|
(uint)PermissionMask.Modify |
|
||||||
(uint)PermissionMask.Move |
|
(uint)PermissionMask.Move |
|
||||||
(uint)PermissionMask.Export |
|
(uint)PermissionMask.Export |
|
||||||
7); // Preserve folded permissions
|
(uint)PermissionMask.FoldedMask); // Preserve folded permissions ??
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -1144,9 +1135,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0)
|
if ((item.BasePermissions & (uint)PermissionMask.FoldedMask) != 0)
|
||||||
{
|
{
|
||||||
// We have permissions stored there so use them
|
// We have permissions stored there so use them
|
||||||
part.NextOwnerMask = ((item.BasePermissions & 7) << 13);
|
part.NextOwnerMask = ((item.BasePermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift);
|
||||||
if ((item.BasePermissions & (uint)PermissionMask.FoldedExport) != 0)
|
|
||||||
part.NextOwnerMask |= (uint)PermissionMask.Export;
|
|
||||||
part.NextOwnerMask |= (uint)PermissionMask.Move;
|
part.NextOwnerMask |= (uint)PermissionMask.Move;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -223,20 +223,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
if (parms.Length - i < 2)
|
if (parms.Length - i < 2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Have we reached the end of the list of headers?
|
|
||||||
//End is marked by a string with a single digit.
|
|
||||||
//We already know we have at least one parameter
|
|
||||||
//so it is safe to do this check at top of loop.
|
|
||||||
if (Char.IsDigit(parms[i][0]))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (htc.HttpCustomHeaders == null)
|
if (htc.HttpCustomHeaders == null)
|
||||||
htc.HttpCustomHeaders = new List<string>();
|
htc.HttpCustomHeaders = new List<string>();
|
||||||
|
|
||||||
htc.HttpCustomHeaders.Add(parms[i]);
|
htc.HttpCustomHeaders.Add(parms[i]);
|
||||||
htc.HttpCustomHeaders.Add(parms[i+1]);
|
htc.HttpCustomHeaders.Add(parms[i+1]);
|
||||||
|
int nexti = i + 2;
|
||||||
|
if (nexti >= parms.Length || Char.IsDigit(parms[nexti][0]))
|
||||||
|
break;
|
||||||
|
|
||||||
i += 2;
|
i = nexti;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -26,15 +26,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Sockets;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -89,6 +89,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
protected Dictionary<string, UrlData> m_UrlMap =
|
protected Dictionary<string, UrlData> m_UrlMap =
|
||||||
new Dictionary<string, UrlData>();
|
new Dictionary<string, UrlData>();
|
||||||
|
|
||||||
|
protected bool m_enabled = false;
|
||||||
|
protected string m_ErrorStr;
|
||||||
protected uint m_HttpsPort = 0;
|
protected uint m_HttpsPort = 0;
|
||||||
protected IHttpServer m_HttpServer = null;
|
protected IHttpServer m_HttpServer = null;
|
||||||
protected IHttpServer m_HttpsServer = null;
|
protected IHttpServer m_HttpsServer = null;
|
||||||
|
@ -118,6 +120,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
IConfig networkConfig = config.Configs["Network"];
|
IConfig networkConfig = config.Configs["Network"];
|
||||||
|
m_enabled = false;
|
||||||
|
|
||||||
if (networkConfig != null)
|
if (networkConfig != null)
|
||||||
{
|
{
|
||||||
|
@ -128,9 +131,47 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
if (ssl_enabled)
|
if (ssl_enabled)
|
||||||
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
|
m_HttpsPort = (uint)config.Configs["Network"].GetInt("https_port", (int)m_HttpsPort);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ErrorStr = "[Network] configuration missing, HTTP listener for LSL disabled";
|
||||||
|
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ExternalHostNameForLSL == null)
|
if (String.IsNullOrWhiteSpace(ExternalHostNameForLSL))
|
||||||
ExternalHostNameForLSL = System.Environment.MachineName;
|
{
|
||||||
|
m_ErrorStr = "ExternalHostNameForLSL not defined in configuration, HTTP listener for LSL disabled";
|
||||||
|
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IPAddress ia = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL))
|
||||||
|
{
|
||||||
|
if (Adr.AddressFamily == AddressFamily.InterNetwork ||
|
||||||
|
Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke
|
||||||
|
{
|
||||||
|
ia = Adr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
ia = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ia == null)
|
||||||
|
{
|
||||||
|
m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled";
|
||||||
|
m_log.Warn("[URL MODULE]: " + m_ErrorStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_enabled = true;
|
||||||
|
m_ErrorStr = String.Empty;
|
||||||
|
|
||||||
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
|
IConfig llFunctionsConfig = config.Configs["LL-Functions"];
|
||||||
|
|
||||||
|
@ -146,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (m_HttpServer == null)
|
if (m_enabled && m_HttpServer == null)
|
||||||
{
|
{
|
||||||
// There can only be one
|
// There can only be one
|
||||||
//
|
//
|
||||||
|
@ -197,11 +238,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
UUID urlcode = UUID.Random();
|
UUID urlcode = UUID.Random();
|
||||||
|
|
||||||
|
if(!m_enabled)
|
||||||
|
{
|
||||||
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr });
|
||||||
|
return urlcode;
|
||||||
|
}
|
||||||
|
|
||||||
lock (m_UrlMap)
|
lock (m_UrlMap)
|
||||||
{
|
{
|
||||||
if (m_UrlMap.Count >= TotalUrls)
|
if (m_UrlMap.Count >= TotalUrls)
|
||||||
{
|
{
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED",
|
||||||
|
"Too many URLs already open" });
|
||||||
return urlcode;
|
return urlcode;
|
||||||
}
|
}
|
||||||
string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
string url = "http://" + ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/";
|
||||||
|
@ -243,6 +291,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
UUID urlcode = UUID.Random();
|
UUID urlcode = UUID.Random();
|
||||||
|
|
||||||
|
if(!m_enabled)
|
||||||
|
{
|
||||||
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", m_ErrorStr });
|
||||||
|
return urlcode;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_HttpsServer == null)
|
if (m_HttpsServer == null)
|
||||||
{
|
{
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
||||||
|
@ -253,7 +307,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
{
|
{
|
||||||
if (m_UrlMap.Count >= TotalUrls)
|
if (m_UrlMap.Count >= TotalUrls)
|
||||||
{
|
{
|
||||||
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" });
|
engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED",
|
||||||
|
"Too many URLs already open" });
|
||||||
return urlcode;
|
return urlcode;
|
||||||
}
|
}
|
||||||
string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
|
string url = "https://" + ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + "/lslhttps/" + urlcode.ToString() + "/";
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
// wrap this in a try block so that defaults will work if
|
// wrap this in a try block so that defaults will work if
|
||||||
// the config file doesn't specify otherwise.
|
// the config file doesn't specify otherwise.
|
||||||
int maxlisteners = 1000;
|
int maxlisteners = 1000;
|
||||||
int maxhandles = 64;
|
int maxhandles = 65;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_whisperdistance = config.Configs["Chat"].GetInt(
|
m_whisperdistance = config.Configs["Chat"].GetInt(
|
||||||
|
@ -130,8 +130,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if (maxlisteners < 1) maxlisteners = int.MaxValue;
|
|
||||||
if (maxhandles < 1) maxhandles = int.MaxValue;
|
if (maxlisteners < 1)
|
||||||
|
maxlisteners = int.MaxValue;
|
||||||
|
if (maxhandles < 1)
|
||||||
|
maxhandles = int.MaxValue;
|
||||||
|
|
||||||
|
if (maxlisteners < maxhandles)
|
||||||
|
maxlisteners = maxhandles;
|
||||||
|
|
||||||
m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
|
m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
|
||||||
m_pendingQ = new Queue();
|
m_pendingQ = new Queue();
|
||||||
m_pending = Queue.Synchronized(m_pendingQ);
|
m_pending = Queue.Synchronized(m_pendingQ);
|
||||||
|
@ -605,11 +612,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
li.GetHandle().Equals(handle))
|
li.GetHandle().Equals(handle))
|
||||||
{
|
{
|
||||||
lis.Value.Remove(li);
|
lis.Value.Remove(li);
|
||||||
if (lis.Value.Count == 0)
|
|
||||||
{
|
|
||||||
m_listeners.Remove(lis.Key);
|
|
||||||
m_curlisteners--;
|
m_curlisteners--;
|
||||||
}
|
if (lis.Value.Count == 0)
|
||||||
|
m_listeners.Remove(lis.Key); // bailing of loop so this does not smoke
|
||||||
// there should be only one, so we bail out early
|
// there should be only one, so we bail out early
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -718,6 +723,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(handles.Count >= m_maxhandles)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// Note: 0 is NOT a valid handle for llListen() to return
|
// Note: 0 is NOT a valid handle for llListen() to return
|
||||||
for (int i = 1; i <= m_maxhandles; i++)
|
for (int i = 1; i <= m_maxhandles; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,6 +118,11 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
|
if(group == null || group.IsDeleted || group.inTransit)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// make sure we are not buying a child part
|
||||||
|
part = group.RootPart;
|
||||||
|
|
||||||
switch (saleType)
|
switch (saleType)
|
||||||
{
|
{
|
||||||
|
@ -157,18 +162,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Sell a copy
|
case 2: // Sell a copy
|
||||||
Vector3 inventoryStoredPosition = new Vector3(
|
|
||||||
Math.Min(group.AbsolutePosition.X, m_scene.RegionInfo.RegionSizeX - 6),
|
|
||||||
Math.Min(group.AbsolutePosition.Y, m_scene.RegionInfo.RegionSizeY - 6),
|
|
||||||
group.AbsolutePosition.Z);
|
|
||||||
|
|
||||||
Vector3 originalPosition = group.AbsolutePosition;
|
|
||||||
|
|
||||||
group.AbsolutePosition = inventoryStoredPosition;
|
|
||||||
|
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
|
||||||
group.AbsolutePosition = originalPosition;
|
|
||||||
|
|
||||||
uint perms = group.EffectiveOwnerPerms;
|
uint perms = group.EffectiveOwnerPerms;
|
||||||
|
|
||||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||||
|
@ -185,6 +178,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||||
|
|
||||||
AssetBase asset = m_scene.CreateAsset(
|
AssetBase asset = m_scene.CreateAsset(
|
||||||
group.GetPartName(localID),
|
group.GetPartName(localID),
|
||||||
group.GetPartDescription(localID),
|
group.GetPartDescription(localID),
|
||||||
|
@ -206,21 +201,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
||||||
item.InvType = (int)InventoryType.Object;
|
item.InvType = (int)InventoryType.Object;
|
||||||
item.Folder = categoryID;
|
item.Folder = categoryID;
|
||||||
|
|
||||||
uint nextPerms=(perms & 7) << 13;
|
perms = group.CurrentAndFoldedNextPermissions();
|
||||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
// apply parts inventory next perms
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
PermissionsUtil.ApplyNoModFoldedPermissions(perms, ref perms);
|
||||||
if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
|
// change to next owner perms
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
perms &= part.NextOwnerMask;
|
||||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
// update folded
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
perms = PermissionsUtil.FixAndFoldPermissions(perms);
|
||||||
|
|
||||||
|
item.BasePermissions = perms;
|
||||||
|
item.CurrentPermissions = perms;
|
||||||
|
item.NextPermissions = part.NextOwnerMask & perms;
|
||||||
|
item.EveryOnePermissions = part.EveryoneMask & perms;
|
||||||
|
item.GroupPermissions = part.GroupMask & perms;
|
||||||
|
|
||||||
item.BasePermissions = perms & part.NextOwnerMask;
|
|
||||||
item.CurrentPermissions = perms & part.NextOwnerMask;
|
|
||||||
item.NextPermissions = part.NextOwnerMask;
|
|
||||||
item.EveryOnePermissions = part.EveryoneMask &
|
|
||||||
part.NextOwnerMask;
|
|
||||||
item.GroupPermissions = part.GroupMask &
|
|
||||||
part.NextOwnerMask;
|
|
||||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
|
|
|
@ -2022,7 +2022,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
||||||
|
|
||||||
uint perms = GetObjectPermissions(sp, sog, true);
|
uint perms = GetObjectPermissions(sp, sog, true);
|
||||||
if((perms & (uint)PermissionMask.Copy) == 0)
|
if((perms & (uint)PermissionMask.Copy) == 0)
|
||||||
|
{
|
||||||
|
sp.ControllingClient.SendAgentAlertMessage("Copying this item has been denied by the permissions system", false);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
|
if(sog.OwnerID != sp.UUID && (perms & (uint)PermissionMask.Transfer) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -682,30 +682,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// These will be applied to the root prim at next rez.
|
// These will be applied to the root prim at next rez.
|
||||||
// The legacy slam bit (bit 3) and folded permission (bits 0-2)
|
// The legacy slam bit (bit 3) and folded permission (bits 0-2)
|
||||||
// are preserved due to the above mangling
|
// are preserved due to the above mangling
|
||||||
ownerPerms &= nextPerms;
|
// ownerPerms &= nextPerms;
|
||||||
|
|
||||||
// Mask the base permissions. This is a conservative
|
// Mask the base permissions. This is a conservative
|
||||||
// approach altering only the three main perms
|
// approach altering only the three main perms
|
||||||
basePerms &= nextPerms;
|
// basePerms &= nextPerms;
|
||||||
|
|
||||||
// Mask out the folded portion of the base mask.
|
// Mask out the folded portion of the base mask.
|
||||||
// While the owner mask carries the actual folded
|
// While the owner mask carries the actual folded
|
||||||
// permissions, the base mask carries the original
|
// permissions, the base mask carries the original
|
||||||
// base mask, before masking with the folded perms.
|
// base mask, before masking with the folded perms.
|
||||||
// We need this later for rezzing.
|
// We need this later for rezzing.
|
||||||
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
// basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
// basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
||||||
|
|
||||||
// If this is an object, root prim perms may be more
|
// If this is an object, root prim perms may be more
|
||||||
// permissive than folded perms. Use folded perms as
|
// permissive than folded perms. Use folded perms as
|
||||||
// a mask
|
// a mask
|
||||||
if (item.InvType == (int)InventoryType.Object)
|
uint foldedPerms = (item.CurrentPermissions & (uint)PermissionMask.FoldedMask) << (int)PermissionMask.FoldingShift;
|
||||||
|
if (foldedPerms != 0 && item.InvType == (int)InventoryType.Object)
|
||||||
{
|
{
|
||||||
// Create a safe mask for the current perms
|
|
||||||
uint foldedPerms = (item.CurrentPermissions & 7) << 13;
|
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.FoldedExport) != 0)
|
|
||||||
foldedPerms |= (uint)PermissionMask.Export;
|
|
||||||
|
|
||||||
foldedPerms |= permsMask;
|
foldedPerms |= permsMask;
|
||||||
|
|
||||||
bool isRootMod = (item.CurrentPermissions &
|
bool isRootMod = (item.CurrentPermissions &
|
||||||
|
@ -729,6 +725,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// move here so nextperms are mandatory
|
||||||
|
ownerPerms &= nextPerms;
|
||||||
|
basePerms &= nextPerms;
|
||||||
|
basePerms &= ~(uint)PermissionMask.FoldedMask;
|
||||||
|
basePerms |= ((basePerms >> 13) & 7) | (((basePerms & (uint)PermissionMask.Export) != 0) ? (uint)PermissionMask.FoldedExport : 0);
|
||||||
// Assign to the actual item. Make sure the slam bit is
|
// Assign to the actual item. Make sure the slam bit is
|
||||||
// set, if it wasn't set before.
|
// set, if it wasn't set before.
|
||||||
itemCopy.BasePermissions = basePerms;
|
itemCopy.BasePermissions = basePerms;
|
||||||
|
@ -1266,20 +1267,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// TODO: Fix this after the inventory fixer exists and has beenr run
|
// TODO: Fix this after the inventory fixer exists and has beenr run
|
||||||
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
uint perms = taskItem.BasePermissions & taskItem.NextPermissions;
|
||||||
if (taskItem.InvType == (int)InventoryType.Object)
|
if (taskItem.InvType == (int)InventoryType.Object)
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move));
|
{
|
||||||
|
PermissionsUtil.ApplyFoldedPermissions(taskItem.CurrentPermissions, ref perms );
|
||||||
|
perms = PermissionsUtil.FixAndFoldPermissions(perms);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions;
|
perms &= taskItem.CurrentPermissions;
|
||||||
|
|
||||||
agentItem.BasePermissions = agentItem.CurrentPermissions;
|
// always unlock
|
||||||
|
perms |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
|
agentItem.BasePermissions = perms;
|
||||||
|
agentItem.CurrentPermissions = perms;
|
||||||
|
agentItem.NextPermissions = perms & taskItem.NextPermissions;
|
||||||
|
agentItem.EveryOnePermissions = perms & taskItem.EveryonePermissions;
|
||||||
|
agentItem.GroupPermissions = perms & taskItem.GroupPermissions;
|
||||||
|
|
||||||
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
agentItem.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
||||||
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
agentItem.Flags &= ~(uint)(InventoryItemFlags.ObjectOverwriteBase | InventoryItemFlags.ObjectOverwriteOwner | InventoryItemFlags.ObjectOverwriteGroup | InventoryItemFlags.ObjectOverwriteEveryone | InventoryItemFlags.ObjectOverwriteNextOwner);
|
||||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
|
||||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move);
|
|
||||||
// Group permissions make no sense here
|
|
||||||
agentItem.GroupPermissions = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1287,7 +1294,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agentItem.CurrentPermissions = taskItem.CurrentPermissions;
|
agentItem.CurrentPermissions = taskItem.CurrentPermissions;
|
||||||
agentItem.NextPermissions = taskItem.NextPermissions;
|
agentItem.NextPermissions = taskItem.NextPermissions;
|
||||||
agentItem.EveryOnePermissions = taskItem.EveryonePermissions;
|
agentItem.EveryOnePermissions = taskItem.EveryonePermissions;
|
||||||
agentItem.GroupPermissions = 0;
|
agentItem.GroupPermissions = taskItem.GroupPermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = null;
|
message = null;
|
||||||
|
|
|
@ -252,70 +252,81 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
// new test code, to place in better place later
|
// new test code, to place in better place later
|
||||||
private object PermissionsLock = new object();
|
private object m_PermissionsLock = new object();
|
||||||
|
private bool m_EffectivePermsInvalid = true;
|
||||||
|
|
||||||
|
public void InvalidateEffectivePerms()
|
||||||
|
{
|
||||||
|
lock(m_PermissionsLock)
|
||||||
|
m_EffectivePermsInvalid = true;
|
||||||
|
}
|
||||||
|
|
||||||
private uint m_EffectiveEveryOnePerms;
|
private uint m_EffectiveEveryOnePerms;
|
||||||
public uint EffectiveEveryOnePerms
|
public uint EffectiveEveryOnePerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
lock(m_PermissionsLock)
|
||||||
// bc this is on heavy duty code paths
|
{
|
||||||
// but for now we need to test the concept
|
if(m_EffectivePermsInvalid)
|
||||||
// AggregateDeepPerms();
|
AggregatePerms();
|
||||||
return m_EffectiveEveryOnePerms;
|
return m_EffectiveEveryOnePerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private uint m_EffectiveGroupPerms;
|
private uint m_EffectiveGroupPerms;
|
||||||
public uint EffectiveGroupPerms
|
public uint EffectiveGroupPerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
lock(m_PermissionsLock)
|
||||||
// bc this is on heavy duty code paths
|
{
|
||||||
// but for now we need to test the concept
|
if(m_EffectivePermsInvalid)
|
||||||
// AggregateDeepPerms();
|
AggregatePerms();
|
||||||
return m_EffectiveGroupPerms;
|
return m_EffectiveGroupPerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private uint m_EffectiveGroupOrEveryOnePerms;
|
private uint m_EffectiveGroupOrEveryOnePerms;
|
||||||
public uint EffectiveGroupOrEveryOnePerms
|
public uint EffectiveGroupOrEveryOnePerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
lock(m_PermissionsLock)
|
||||||
// bc this is on heavy duty code paths
|
{
|
||||||
// but for now we need to test the concept
|
if(m_EffectivePermsInvalid)
|
||||||
// AggregateDeepPerms();
|
AggregatePerms();
|
||||||
return m_EffectiveGroupOrEveryOnePerms;
|
return m_EffectiveGroupOrEveryOnePerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private uint m_EffectiveOwnerPerms;
|
private uint m_EffectiveOwnerPerms;
|
||||||
public uint EffectiveOwnerPerms
|
public uint EffectiveOwnerPerms
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
|
lock(m_PermissionsLock)
|
||||||
// bc this is on heavy duty code paths
|
{
|
||||||
// but for now we need to test the concept
|
if(m_EffectivePermsInvalid)
|
||||||
// AggregateDeepPerms();
|
AggregatePerms();
|
||||||
return m_EffectiveOwnerPerms;
|
return m_EffectiveOwnerPerms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// aggregates perms scanning parts and their contents
|
// aggregates perms scanning parts and their contents
|
||||||
// AggregatePerms does same using cached parts content perms
|
// AggregatePerms does same using cached parts content perms
|
||||||
public void AggregateDeepPerms()
|
public void AggregateDeepPerms()
|
||||||
{
|
{
|
||||||
lock(PermissionsLock)
|
lock(m_PermissionsLock)
|
||||||
{
|
{
|
||||||
// aux
|
// aux
|
||||||
const uint allmask = (uint)PermissionMask.AllEffective;
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
|
||||||
const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
const uint copytransfermask = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
uint basePerms = (RootPart.BaseMask & allmask) | (uint)PermissionMask.Move;
|
||||||
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
bool noBaseTransfer = (basePerms & (uint)PermissionMask.Transfer) == 0;
|
||||||
|
@ -327,6 +338,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
uint rootEveryonePerms = RootPart.EveryoneMask;
|
uint rootEveryonePerms = RootPart.EveryoneMask;
|
||||||
uint everyone = rootEveryonePerms;
|
uint everyone = rootEveryonePerms;
|
||||||
|
|
||||||
|
// date is time of writing april 30th 2017
|
||||||
|
bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -334,12 +347,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.AggregateInnerPerms();
|
part.AggregateInnerPerms();
|
||||||
owner &= part.AggregatedInnerOwnerPerms;
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
group &= part.AggregatedInnerGroupPerms;
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
if(newObject)
|
||||||
everyone &= part.AggregatedInnerEveryonePerms;
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
}
|
}
|
||||||
// recover modify and move
|
// recover modify and move
|
||||||
rootOwnerPerms &= movemodmask;
|
rootOwnerPerms &= movemodmask;
|
||||||
owner |= rootOwnerPerms;
|
owner |= rootOwnerPerms;
|
||||||
if((owner & copytransfermast) == 0)
|
if((owner & copytransfermask) == 0)
|
||||||
owner |= (uint)PermissionMask.Transfer;
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
owner &= basePerms;
|
owner &= basePerms;
|
||||||
|
@ -370,6 +384,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_EffectiveEveryOnePerms = everyone & owner;
|
m_EffectiveEveryOnePerms = everyone & owner;
|
||||||
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
|
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
|
||||||
|
m_EffectivePermsInvalid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +392,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
|
// ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop
|
||||||
public void AggregatePerms()
|
public void AggregatePerms()
|
||||||
{
|
{
|
||||||
lock(PermissionsLock)
|
lock(m_PermissionsLock)
|
||||||
{
|
{
|
||||||
// aux
|
// aux
|
||||||
const uint allmask = (uint)PermissionMask.AllEffective;
|
const uint allmask = (uint)PermissionMask.AllEffective;
|
||||||
|
@ -394,12 +409,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
uint rootEveryonePerms = RootPart.EveryoneMask;
|
uint rootEveryonePerms = RootPart.EveryoneMask;
|
||||||
uint everyone = rootEveryonePerms;
|
uint everyone = rootEveryonePerms;
|
||||||
|
|
||||||
|
bool needUpdate = false;
|
||||||
|
// date is time of writing april 30th 2017
|
||||||
|
bool newObject = (RootPart.CreationDate == 0 || RootPart.CreationDate > 1493574994);
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
owner &= part.AggregatedInnerOwnerPerms;
|
owner &= part.AggregatedInnerOwnerPerms;
|
||||||
group &= part.AggregatedInnerGroupPerms;
|
group &= part.AggregatedInnerGroupPerms;
|
||||||
|
if(newObject)
|
||||||
everyone &= part.AggregatedInnerEveryonePerms;
|
everyone &= part.AggregatedInnerEveryonePerms;
|
||||||
}
|
}
|
||||||
// recover modify and move
|
// recover modify and move
|
||||||
|
@ -409,7 +428,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
owner |= (uint)PermissionMask.Transfer;
|
owner |= (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
owner &= basePerms;
|
owner &= basePerms;
|
||||||
|
if(owner != m_EffectiveOwnerPerms)
|
||||||
|
{
|
||||||
|
needUpdate = true;
|
||||||
m_EffectiveOwnerPerms = owner;
|
m_EffectiveOwnerPerms = owner;
|
||||||
|
}
|
||||||
|
|
||||||
uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
|
uint ownertransfermask = owner & (uint)PermissionMask.Transfer;
|
||||||
|
|
||||||
// recover modify and move
|
// recover modify and move
|
||||||
|
@ -421,7 +445,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
group |= ownertransfermask;
|
group |= ownertransfermask;
|
||||||
|
|
||||||
uint groupOrEveryone = group;
|
uint groupOrEveryone = group;
|
||||||
m_EffectiveGroupPerms = group & owner;
|
uint tmpPerms = group & owner;
|
||||||
|
if(tmpPerms != m_EffectiveGroupPerms)
|
||||||
|
{
|
||||||
|
needUpdate = true;
|
||||||
|
m_EffectiveGroupPerms = tmpPerms;
|
||||||
|
}
|
||||||
|
|
||||||
// recover move
|
// recover move
|
||||||
rootEveryonePerms &= (uint)PermissionMask.Move;
|
rootEveryonePerms &= (uint)PermissionMask.Move;
|
||||||
|
@ -434,35 +463,42 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
groupOrEveryone |= everyone;
|
groupOrEveryone |= everyone;
|
||||||
|
|
||||||
m_EffectiveEveryOnePerms = everyone & owner;
|
tmpPerms = everyone & owner;
|
||||||
m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner;
|
if(tmpPerms != m_EffectiveEveryOnePerms)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint GetEffectivePermissions()
|
|
||||||
{
|
{
|
||||||
return GetEffectivePermissions(false);
|
needUpdate = true;
|
||||||
|
m_EffectiveEveryOnePerms = tmpPerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetEffectivePermissions(bool useBase)
|
tmpPerms = groupOrEveryone & owner;
|
||||||
|
if(tmpPerms != m_EffectiveGroupOrEveryOnePerms)
|
||||||
|
{
|
||||||
|
needUpdate = true;
|
||||||
|
m_EffectiveGroupOrEveryOnePerms = tmpPerms;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_EffectivePermsInvalid = false;
|
||||||
|
|
||||||
|
if(needUpdate)
|
||||||
|
RootPart.ScheduleFullUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint CurrentAndFoldedNextPermissions()
|
||||||
{
|
{
|
||||||
uint perms=(uint)(PermissionMask.Modify |
|
uint perms=(uint)(PermissionMask.Modify |
|
||||||
PermissionMask.Copy |
|
PermissionMask.Copy |
|
||||||
PermissionMask.Move |
|
PermissionMask.Move |
|
||||||
PermissionMask.Transfer) | 7;
|
PermissionMask.Transfer |
|
||||||
|
PermissionMask.FoldedMask);
|
||||||
|
|
||||||
uint ownerMask = 0x7fffffff;
|
uint ownerMask = RootPart.OwnerMask;
|
||||||
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
|
|
||||||
if (useBase)
|
|
||||||
ownerMask &= part.BaseMask;
|
ownerMask &= part.BaseMask;
|
||||||
else
|
|
||||||
ownerMask &= part.OwnerMask;
|
|
||||||
|
|
||||||
perms &= part.Inventory.MaskEffectivePermissions();
|
perms &= part.Inventory.MaskEffectivePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,17 +508,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
perms &= ~(uint)PermissionMask.Copy;
|
||||||
if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
|
if ((ownerMask & (uint)PermissionMask.Transfer) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Transfer;
|
perms &= ~(uint)PermissionMask.Transfer;
|
||||||
|
if ((ownerMask & (uint)PermissionMask.Export) == 0)
|
||||||
// If root prim permissions are applied here, this would screw
|
perms &= ~(uint)PermissionMask.Export;
|
||||||
// with in-inventory manipulation of the next owner perms
|
|
||||||
// in a major way. So, let's move this to the give itself.
|
|
||||||
// Yes. I know. Evil.
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Modify >> 13);
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Copy >> 13);
|
|
||||||
// if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
|
||||||
// perms &= ~((uint)PermissionMask.Transfer >> 13);
|
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2579,6 +2579,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AggregatedInnerOwnerPerms = owner & mask;
|
AggregatedInnerOwnerPerms = owner & mask;
|
||||||
AggregatedInnerGroupPerms = group & mask;
|
AggregatedInnerGroupPerms = group & mask;
|
||||||
AggregatedInnerEveryonePerms = everyone & mask;
|
AggregatedInnerEveryonePerms = everyone & mask;
|
||||||
|
if(ParentGroup != null)
|
||||||
|
ParentGroup.InvalidateEffectivePerms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5286,9 +5288,9 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
// Export needs to be preserved in the base and everyone
|
// Export needs to be preserved in the base and everyone
|
||||||
// mask, but removed in the owner mask as a next owner
|
// mask, but removed in the owner mask as a next owner
|
||||||
// can never change the export status
|
// can never change the export status
|
||||||
BaseMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
BaseMask &= (NextOwnerMask | (uint)PermissionMask.Export);
|
||||||
OwnerMask &= NextOwnerMask;
|
OwnerMask &= NextOwnerMask;
|
||||||
EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
EveryoneMask &= (NextOwnerMask | (uint)PermissionMask.Export);
|
||||||
GroupMask = 0; // Giving an object zaps group permissions
|
GroupMask = 0; // Giving an object zaps group permissions
|
||||||
|
|
||||||
Inventory.ApplyNextOwnerPermissions();
|
Inventory.ApplyNextOwnerPermissions();
|
||||||
|
|
|
@ -1332,6 +1332,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
|
if(item.InvType == (sbyte)InventoryType.Landmark)
|
||||||
|
continue;
|
||||||
owner &= item.CurrentPermissions;
|
owner &= item.CurrentPermissions;
|
||||||
group &= item.GroupPermissions;
|
group &= item.GroupPermissions;
|
||||||
everyone &= item.EveryonePermissions;
|
everyone &= item.EveryonePermissions;
|
||||||
|
@ -1340,33 +1342,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public uint MaskEffectivePermissions()
|
public uint MaskEffectivePermissions()
|
||||||
{
|
{
|
||||||
|
// used to propagate permissions restrictions outwards
|
||||||
|
// Modify does not propagate outwards.
|
||||||
uint mask=0x7fffffff;
|
uint mask=0x7fffffff;
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
if(item.InvType == (sbyte)InventoryType.Landmark)
|
||||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
continue;
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
|
|
||||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
|
||||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
|
|
||||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
|
||||||
|
|
||||||
if (item.InvType == (int)InventoryType.Object)
|
// apply current to normal permission bits
|
||||||
{
|
uint newperms = item.CurrentPermissions;
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
|
||||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
|
||||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
|
||||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
if ((newperms & (uint)PermissionMask.Copy) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Copy;
|
mask &= ~(uint)PermissionMask.Copy;
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
if ((newperms & (uint)PermissionMask.Transfer) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Transfer;
|
mask &= ~(uint)PermissionMask.Transfer;
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
|
if ((newperms & (uint)PermissionMask.Export) == 0)
|
||||||
mask &= ~(uint)PermissionMask.Modify;
|
mask &= ~((uint)PermissionMask.Export);
|
||||||
|
|
||||||
|
// apply next owner restricted by current to folded bits
|
||||||
|
newperms &= item.NextPermissions;
|
||||||
|
|
||||||
|
if ((newperms & (uint)PermissionMask.Copy) == 0)
|
||||||
|
mask &= ~((uint)PermissionMask.FoldedCopy);
|
||||||
|
if ((newperms & (uint)PermissionMask.Transfer) == 0)
|
||||||
|
mask &= ~((uint)PermissionMask.FoldedTransfer);
|
||||||
|
if ((newperms & (uint)PermissionMask.Export) == 0)
|
||||||
|
mask &= ~((uint)PermissionMask.FoldedExport);
|
||||||
|
|
||||||
}
|
}
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
@ -1375,19 +1379,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
foreach (TaskInventoryItem item in m_items.Values)
|
||||||
{
|
{
|
||||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat (
|
|
||||||
// "[SCENE OBJECT PART INVENTORY]: Applying next permissions {0} to {1} in {2} with current {3}, base {4}, everyone {5}",
|
|
||||||
// item.NextPermissions, item.Name, m_part.Name, item.CurrentPermissions, item.BasePermissions, item.EveryonePermissions);
|
|
||||||
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
|
|
||||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
|
|
||||||
item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
|
|
||||||
}
|
|
||||||
item.CurrentPermissions &= item.NextPermissions;
|
item.CurrentPermissions &= item.NextPermissions;
|
||||||
item.BasePermissions &= item.NextPermissions;
|
item.BasePermissions &= item.NextPermissions;
|
||||||
item.EveryonePermissions &= item.NextPermissions;
|
item.EveryonePermissions &= item.NextPermissions;
|
||||||
|
|
|
@ -755,8 +755,8 @@ namespace PrimMesher
|
||||||
if (hollowAngles.angles[0].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[maxJ].angle + 0.000001f)
|
if (hollowAngles.angles[0].angle - angles.angles[i].angle < angles.angles[i].angle - hollowAngles.angles[maxJ].angle + 0.000001f)
|
||||||
{
|
{
|
||||||
newFace.v1 = 0;
|
newFace.v1 = 0;
|
||||||
newFace.v2 = numTotalVerts - maxJ - 1;
|
newFace.v2 = numTotalVerts - 1;
|
||||||
newFace.v3 = numTotalVerts - 1;
|
newFace.v3 = numTotalVerts - maxJ - 1;
|
||||||
|
|
||||||
faces.Add(newFace);
|
faces.Add(newFace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13405,6 +13405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
List<string> param = new List<string>();
|
List<string> param = new List<string>();
|
||||||
bool ok;
|
bool ok;
|
||||||
Int32 flag;
|
Int32 flag;
|
||||||
|
int nCustomHeaders = 0;
|
||||||
|
|
||||||
for (int i = 0; i < parameters.Data.Length; i += 2)
|
for (int i = 0; i < parameters.Data.Length; i += 2)
|
||||||
{
|
{
|
||||||
|
@ -13431,6 +13432,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
//Second Life documentation for llHTTPRequest.
|
//Second Life documentation for llHTTPRequest.
|
||||||
for (int count = 1; count <= 8; ++count)
|
for (int count = 1; count <= 8; ++count)
|
||||||
{
|
{
|
||||||
|
if(nCustomHeaders >= 8)
|
||||||
|
{
|
||||||
|
Error("llHTTPRequest", "Max number of custom headers is 8, excess ignored");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//Enough parameters remaining for (another) header?
|
//Enough parameters remaining for (another) header?
|
||||||
if (parameters.Data.Length - i < 2)
|
if (parameters.Data.Length - i < 2)
|
||||||
{
|
{
|
||||||
|
@ -13445,15 +13452,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
param.Add(parameters.Data[i].ToString());
|
param.Add(parameters.Data[i].ToString());
|
||||||
param.Add(parameters.Data[i+1].ToString());
|
param.Add(parameters.Data[i+1].ToString());
|
||||||
|
nCustomHeaders++;
|
||||||
|
|
||||||
//Have we reached the end of the list of headers?
|
//Have we reached the end of the list of headers?
|
||||||
//End is marked by a string with a single digit.
|
//End is marked by a string with a single digit.
|
||||||
if (i + 2 >= parameters.Data.Length ||
|
if (i + 2 >= parameters.Data.Length ||
|
||||||
Char.IsDigit(parameters.Data[i].ToString()[0]))
|
Char.IsDigit(parameters.Data[i + 2].ToString()[0]))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,17 +87,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||||
uint port = 9999;
|
uint port = 9999;
|
||||||
MainServer.RemoveHttpServer(port);
|
MainServer.RemoveHttpServer(port);
|
||||||
|
|
||||||
BaseHttpServer server = new BaseHttpServer(port, false, "", "", "");
|
m_engine = new MockScriptEngine();
|
||||||
|
m_urlModule = new UrlModule();
|
||||||
|
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Network");
|
||||||
|
config.Configs["Network"].Set("ExternalHostNameForLSL", "127.0.0.1");
|
||||||
|
m_scene = new SceneHelpers().SetupScene();
|
||||||
|
|
||||||
|
BaseHttpServer server = new BaseHttpServer(port, false, 0, "");
|
||||||
MainServer.AddHttpServer(server);
|
MainServer.AddHttpServer(server);
|
||||||
MainServer.Instance = server;
|
MainServer.Instance = server;
|
||||||
|
|
||||||
server.Start();
|
server.Start();
|
||||||
|
|
||||||
m_engine = new MockScriptEngine();
|
SceneHelpers.SetupSceneModules(m_scene, config, m_engine, m_urlModule);
|
||||||
m_urlModule = new UrlModule();
|
|
||||||
|
|
||||||
m_scene = new SceneHelpers().SetupScene();
|
|
||||||
SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine, m_urlModule);
|
|
||||||
|
|
||||||
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene);
|
||||||
m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);
|
m_scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, so.RootPart);
|
||||||
|
|
|
@ -909,9 +909,9 @@ namespace OpenSim.Services.GridService
|
||||||
private void OutputRegionsToConsoleSummary(List<RegionData> regions)
|
private void OutputRegionsToConsoleSummary(List<RegionData> regions)
|
||||||
{
|
{
|
||||||
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
||||||
dispTable.AddColumn("Name", 44);
|
dispTable.AddColumn("Name", ConsoleDisplayUtil.RegionNameSize);
|
||||||
dispTable.AddColumn("ID", 36);
|
dispTable.AddColumn("ID", ConsoleDisplayUtil.UuidSize);
|
||||||
dispTable.AddColumn("Position", 11);
|
dispTable.AddColumn("Position", ConsoleDisplayUtil.CoordTupleSize);
|
||||||
dispTable.AddColumn("Size", 11);
|
dispTable.AddColumn("Size", 11);
|
||||||
dispTable.AddColumn("Flags", 60);
|
dispTable.AddColumn("Flags", 60);
|
||||||
|
|
||||||
|
|
|
@ -640,9 +640,11 @@ namespace OpenSim.Services.UserAccountService
|
||||||
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID);
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID);
|
||||||
|
|
||||||
InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart);
|
InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart);
|
||||||
|
// Get Current Outfit folder
|
||||||
|
InventoryFolderBase currentOutfitFolder = m_InventoryService.GetFolderForType(principalID, FolderType.CurrentOutfit);
|
||||||
|
|
||||||
InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID);
|
InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID);
|
||||||
eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
|
eyes.AssetID = AvatarWearable.DEFAULT_EYES_ASSET;
|
||||||
eyes.Name = "Default Eyes";
|
eyes.Name = "Default Eyes";
|
||||||
eyes.CreatorId = principalID.ToString();
|
eyes.CreatorId = principalID.ToString();
|
||||||
eyes.AssetType = (int)AssetType.Bodypart;
|
eyes.AssetType = (int)AssetType.Bodypart;
|
||||||
|
@ -655,6 +657,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
eyes.NextPermissions = (uint)PermissionMask.All;
|
eyes.NextPermissions = (uint)PermissionMask.All;
|
||||||
eyes.Flags = (uint)WearableType.Eyes;
|
eyes.Flags = (uint)WearableType.Eyes;
|
||||||
m_InventoryService.AddItem(eyes);
|
m_InventoryService.AddItem(eyes);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Eyes, eyes.Name, eyes.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID);
|
InventoryItemBase shape = new InventoryItemBase(UUID.Random(), principalID);
|
||||||
shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
|
shape.AssetID = AvatarWearable.DEFAULT_BODY_ASSET;
|
||||||
|
@ -670,6 +673,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
shape.NextPermissions = (uint)PermissionMask.All;
|
shape.NextPermissions = (uint)PermissionMask.All;
|
||||||
shape.Flags = (uint)WearableType.Shape;
|
shape.Flags = (uint)WearableType.Shape;
|
||||||
m_InventoryService.AddItem(shape);
|
m_InventoryService.AddItem(shape);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Shape, shape.Name, shape.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID);
|
InventoryItemBase skin = new InventoryItemBase(UUID.Random(), principalID);
|
||||||
skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
|
skin.AssetID = AvatarWearable.DEFAULT_SKIN_ASSET;
|
||||||
|
@ -685,6 +689,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
skin.NextPermissions = (uint)PermissionMask.All;
|
skin.NextPermissions = (uint)PermissionMask.All;
|
||||||
skin.Flags = (uint)WearableType.Skin;
|
skin.Flags = (uint)WearableType.Skin;
|
||||||
m_InventoryService.AddItem(skin);
|
m_InventoryService.AddItem(skin);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Skin, skin.Name, skin.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID);
|
InventoryItemBase hair = new InventoryItemBase(UUID.Random(), principalID);
|
||||||
hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
|
hair.AssetID = AvatarWearable.DEFAULT_HAIR_ASSET;
|
||||||
|
@ -700,6 +705,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
hair.NextPermissions = (uint)PermissionMask.All;
|
hair.NextPermissions = (uint)PermissionMask.All;
|
||||||
hair.Flags = (uint)WearableType.Hair;
|
hair.Flags = (uint)WearableType.Hair;
|
||||||
m_InventoryService.AddItem(hair);
|
m_InventoryService.AddItem(hair);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Hair, hair.Name, hair.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing);
|
InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing);
|
||||||
|
|
||||||
|
@ -717,6 +723,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
shirt.NextPermissions = (uint)PermissionMask.All;
|
shirt.NextPermissions = (uint)PermissionMask.All;
|
||||||
shirt.Flags = (uint)WearableType.Shirt;
|
shirt.Flags = (uint)WearableType.Shirt;
|
||||||
m_InventoryService.AddItem(shirt);
|
m_InventoryService.AddItem(shirt);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Shirt, shirt.Name, shirt.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID);
|
InventoryItemBase pants = new InventoryItemBase(UUID.Random(), principalID);
|
||||||
pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
|
pants.AssetID = AvatarWearable.DEFAULT_PANTS_ASSET;
|
||||||
|
@ -732,6 +739,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
pants.NextPermissions = (uint)PermissionMask.All;
|
pants.NextPermissions = (uint)PermissionMask.All;
|
||||||
pants.Flags = (uint)WearableType.Pants;
|
pants.Flags = (uint)WearableType.Pants;
|
||||||
m_InventoryService.AddItem(pants);
|
m_InventoryService.AddItem(pants);
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, (uint)WearableType.Pants, pants.Name, pants.ID, principalID, currentOutfitFolder.ID);
|
||||||
|
|
||||||
if (m_AvatarService != null)
|
if (m_AvatarService != null)
|
||||||
{
|
{
|
||||||
|
@ -815,6 +823,8 @@ namespace OpenSim.Services.UserAccountService
|
||||||
{
|
{
|
||||||
// Get Clothing folder of receiver
|
// Get Clothing folder of receiver
|
||||||
InventoryFolderBase destinationFolder = m_InventoryService.GetFolderForType(destination, FolderType.Clothing);
|
InventoryFolderBase destinationFolder = m_InventoryService.GetFolderForType(destination, FolderType.Clothing);
|
||||||
|
// Get Current Outfit folder
|
||||||
|
InventoryFolderBase currentOutfitFolder = m_InventoryService.GetFolderForType(destination, FolderType.CurrentOutfit);
|
||||||
|
|
||||||
if (destinationFolder == null)
|
if (destinationFolder == null)
|
||||||
throw new Exception("Cannot locate folder(s)");
|
throw new Exception("Cannot locate folder(s)");
|
||||||
|
@ -841,6 +851,7 @@ namespace OpenSim.Services.UserAccountService
|
||||||
for (int i = 0; i < wearables.Length; i++)
|
for (int i = 0; i < wearables.Length; i++)
|
||||||
{
|
{
|
||||||
wearable = wearables[i];
|
wearable = wearables[i];
|
||||||
|
m_log.DebugFormat("[XXX]: Getting item {0} from avie {1}", wearable[0].ItemID, source);
|
||||||
if (wearable[0].ItemID != UUID.Zero)
|
if (wearable[0].ItemID != UUID.Zero)
|
||||||
{
|
{
|
||||||
// Get inventory item and copy it
|
// Get inventory item and copy it
|
||||||
|
@ -878,6 +889,9 @@ namespace OpenSim.Services.UserAccountService
|
||||||
AvatarWearable newWearable = new AvatarWearable();
|
AvatarWearable newWearable = new AvatarWearable();
|
||||||
newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
|
newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
|
||||||
avatarAppearance.SetWearable(i, newWearable);
|
avatarAppearance.SetWearable(i, newWearable);
|
||||||
|
|
||||||
|
// Add to Current Outfit
|
||||||
|
CreateCurrentOutfitLink((int)InventoryType.Wearable, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -930,6 +944,9 @@ namespace OpenSim.Services.UserAccountService
|
||||||
// Attach item
|
// Attach item
|
||||||
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
|
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
|
||||||
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Attached {0}", destinationItem.ID);
|
m_log.DebugFormat("[USER ACCOUNT SERVICE]: Attached {0}", destinationItem.ID);
|
||||||
|
|
||||||
|
// Add to Current Outfit
|
||||||
|
CreateCurrentOutfitLink(destinationItem.InvType, item.Flags, item.Name, destinationItem.ID, destination, currentOutfitFolder.ID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -939,6 +956,30 @@ namespace OpenSim.Services.UserAccountService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void CreateCurrentOutfitLink(int invType, uint itemType, string name, UUID itemID, UUID userID, UUID currentOutfitFolderUUID)
|
||||||
|
{
|
||||||
|
UUID LinkInvItem = UUID.Random();
|
||||||
|
InventoryItemBase itembase = new InventoryItemBase(LinkInvItem, userID)
|
||||||
|
{
|
||||||
|
AssetID = itemID,
|
||||||
|
AssetType = (int)AssetType.Link,
|
||||||
|
CreatorId = userID.ToString(),
|
||||||
|
InvType = invType,
|
||||||
|
Description = "",
|
||||||
|
//Folder = m_InventoryService.GetFolderForType(userID, FolderType.CurrentOutfit).ID,
|
||||||
|
Folder = currentOutfitFolderUUID,
|
||||||
|
Flags = itemType,
|
||||||
|
Name = name,
|
||||||
|
BasePermissions = (uint)PermissionMask.Copy,
|
||||||
|
CurrentPermissions = (uint)PermissionMask.Copy,
|
||||||
|
EveryOnePermissions = (uint)PermissionMask.Copy,
|
||||||
|
GroupPermissions = (uint)PermissionMask.Copy,
|
||||||
|
NextPermissions = (uint)PermissionMask.Copy
|
||||||
|
};
|
||||||
|
|
||||||
|
m_InventoryService.AddItem(itembase);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply next owner permissions.
|
/// Apply next owner permissions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1,365 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using Nini.Config;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.CoreModules.World.Permissions;
|
||||||
|
using OpenSim.Region.CoreModules.Avatar.Inventory.Transfer;
|
||||||
|
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||||
|
|
||||||
|
namespace OpenSim.Tests.Permissions
|
||||||
|
{
|
||||||
|
[SetUpFixture]
|
||||||
|
public class Common : OpenSimTestCase
|
||||||
|
{
|
||||||
|
public static Common TheInstance;
|
||||||
|
|
||||||
|
public static TestScene TheScene
|
||||||
|
{
|
||||||
|
get { return TheInstance.m_Scene; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ScenePresence[] TheAvatars
|
||||||
|
{
|
||||||
|
get { return TheInstance.m_Avatars; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string Perms = "Owner: {0}; Group: {1}; Everyone: {2}; Next: {3}";
|
||||||
|
private TestScene m_Scene;
|
||||||
|
private ScenePresence[] m_Avatars = new ScenePresence[3];
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public override void SetUp()
|
||||||
|
{
|
||||||
|
if (TheInstance == null)
|
||||||
|
TheInstance = this;
|
||||||
|
|
||||||
|
base.SetUp();
|
||||||
|
TestHelpers.EnableLogging();
|
||||||
|
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Messaging");
|
||||||
|
config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule");
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||||
|
config.AddConfig("InventoryService");
|
||||||
|
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:XInventoryService");
|
||||||
|
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll:TestXInventoryDataPlugin");
|
||||||
|
|
||||||
|
m_Scene = new SceneHelpers().SetupScene("Test", UUID.Random(), 1000, 1000, config);
|
||||||
|
// Add modules
|
||||||
|
SceneHelpers.SetupSceneModules(m_Scene, config, new DefaultPermissionsModule(), new InventoryTransferModule(), new BasicInventoryAccessModule());
|
||||||
|
|
||||||
|
SetUpBasicEnvironment();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The basic environment consists of:
|
||||||
|
/// - 3 avatars: A1, A2, A3
|
||||||
|
/// - 6 simple boxes inworld belonging to A0 and with Next Owner perms:
|
||||||
|
/// C, CT, MC, MCT, MT, T
|
||||||
|
/// - Copies of all of these boxes in A0's inventory in the Objects folder
|
||||||
|
/// - One additional box inworld and in A0's inventory which is a copy of MCT, but
|
||||||
|
/// with C removed in inventory. This one is called MCT-C
|
||||||
|
/// </summary>
|
||||||
|
private void SetUpBasicEnvironment()
|
||||||
|
{
|
||||||
|
Console.WriteLine("===> SetUpBasicEnvironment <===");
|
||||||
|
|
||||||
|
// Add 3 avatars
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
UUID id = TestHelpers.ParseTail(i + 1);
|
||||||
|
|
||||||
|
m_Avatars[i] = AddScenePresence("Bot", "Bot_" + (i+1), id);
|
||||||
|
Assert.That(m_Avatars[i], Is.Not.Null);
|
||||||
|
Assert.That(m_Avatars[i].IsChildAgent, Is.False);
|
||||||
|
Assert.That(m_Avatars[i].UUID, Is.EqualTo(id));
|
||||||
|
Assert.That(m_Scene.GetScenePresences().Count, Is.EqualTo(i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
AddA1Object("Box C", 10, PermissionMask.Copy);
|
||||||
|
AddA1Object("Box CT", 11, PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
AddA1Object("Box MC", 12, PermissionMask.Modify | PermissionMask.Copy);
|
||||||
|
AddA1Object("Box MCT", 13, PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
AddA1Object("Box MT", 14, PermissionMask.Modify | PermissionMask.Transfer);
|
||||||
|
AddA1Object("Box T", 15, PermissionMask.Transfer);
|
||||||
|
|
||||||
|
// MCT-C
|
||||||
|
AddA1Object("Box MCT-C", 16, PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer);
|
||||||
|
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
|
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, m_Avatars[0].UUID, "Objects");
|
||||||
|
List<InventoryItemBase> items = m_Scene.InventoryService.GetFolderItems(m_Avatars[0].UUID, objsFolder.ID);
|
||||||
|
Assert.That(items.Count, Is.EqualTo(7));
|
||||||
|
|
||||||
|
RevokePermission(0, "Box MCT-C", PermissionMask.Copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScenePresence AddScenePresence(string first, string last, UUID id)
|
||||||
|
{
|
||||||
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_Scene, first, last, id, "pw");
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(m_Scene, id);
|
||||||
|
Assert.That(m_Scene.AuthenticateHandler.GetAgentCircuitData(id), Is.Not.Null);
|
||||||
|
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddA1Object(string name, int suffix, PermissionMask nextOwnerPerms)
|
||||||
|
{
|
||||||
|
// Create a Box. Default permissions are just T
|
||||||
|
SceneObjectGroup box = AddSceneObject(name, suffix, 1, m_Avatars[0].UUID);
|
||||||
|
Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Copy) == 0);
|
||||||
|
Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Modify) == 0);
|
||||||
|
Assert.True((box.RootPart.NextOwnerMask & (int)PermissionMask.Transfer) != 0);
|
||||||
|
|
||||||
|
// field = 16 is NextOwner
|
||||||
|
// set = 1 means add the permission; set = 0 means remove permission
|
||||||
|
|
||||||
|
if ((nextOwnerPerms & PermissionMask.Copy) != 0)
|
||||||
|
m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID,
|
||||||
|
((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Copy, 1);
|
||||||
|
|
||||||
|
if ((nextOwnerPerms & PermissionMask.Modify) != 0)
|
||||||
|
m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID,
|
||||||
|
((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Modify, 1);
|
||||||
|
|
||||||
|
if ((nextOwnerPerms & PermissionMask.Transfer) == 0)
|
||||||
|
m_Scene.HandleObjectPermissionsUpdate((IClientAPI)m_Avatars[0].ClientView, m_Avatars[0].UUID,
|
||||||
|
((IClientAPI)(m_Avatars[0].ClientView)).SessionId, 16, box.LocalId, (uint)PermissionMask.Transfer, 0);
|
||||||
|
|
||||||
|
PrintPerms(box);
|
||||||
|
AssertPermissions(nextOwnerPerms, (PermissionMask)box.RootPart.NextOwnerMask, box.OwnerID.ToString().Substring(34) + " : " + box.Name);
|
||||||
|
|
||||||
|
TakeCopyToInventory(0, box);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RevokePermission(int ownerIndex, string name, PermissionMask perm)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = Common.TheInstance.GetItemFromInventory(m_Avatars[ownerIndex].UUID, "Objects", name);
|
||||||
|
Assert.That(item, Is.Not.Null);
|
||||||
|
|
||||||
|
// Clone it, so to avoid aliasing -- just like the viewer does.
|
||||||
|
InventoryItemBase clone = Common.TheInstance.CloneInventoryItem(item);
|
||||||
|
// Revoke the permission in this copy
|
||||||
|
clone.NextPermissions &= ~(uint)perm;
|
||||||
|
Common.TheInstance.AssertPermissions((PermissionMask)clone.NextPermissions & ~perm,
|
||||||
|
(PermissionMask)clone.NextPermissions, Common.TheInstance.IdStr(clone));
|
||||||
|
Assert.That(clone.ID == item.ID);
|
||||||
|
|
||||||
|
// Update properties of the item in inventory. This should affect the original item above.
|
||||||
|
Common.TheScene.UpdateInventoryItemAsset(m_Avatars[ownerIndex].ControllingClient, UUID.Zero, clone.ID, clone);
|
||||||
|
|
||||||
|
item = Common.TheInstance.GetItemFromInventory(m_Avatars[ownerIndex].UUID, "Objects", name);
|
||||||
|
Assert.That(item, Is.Not.Null);
|
||||||
|
Common.TheInstance.PrintPerms(item);
|
||||||
|
Common.TheInstance.AssertPermissions((PermissionMask)item.NextPermissions & ~perm,
|
||||||
|
(PermissionMask)item.NextPermissions, Common.TheInstance.IdStr(item));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PrintPerms(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
Console.WriteLine("SOG " + sog.Name + " (" + sog.OwnerID.ToString().Substring(34) + "): " +
|
||||||
|
String.Format(Perms, (PermissionMask)sog.EffectiveOwnerPerms,
|
||||||
|
(PermissionMask)sog.EffectiveGroupPerms, (PermissionMask)sog.EffectiveEveryOnePerms, (PermissionMask)sog.RootPart.NextOwnerMask));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PrintPerms(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Inv " + item.Name + " (" + item.Owner.ToString().Substring(34) + "): " +
|
||||||
|
String.Format(Perms, (PermissionMask)item.BasePermissions,
|
||||||
|
(PermissionMask)item.GroupPermissions, (PermissionMask)item.EveryOnePermissions, (PermissionMask)item.NextPermissions));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AssertPermissions(PermissionMask desired, PermissionMask actual, string message)
|
||||||
|
{
|
||||||
|
if ((desired & PermissionMask.Copy) != 0)
|
||||||
|
Assert.True((actual & PermissionMask.Copy) != 0, message);
|
||||||
|
else
|
||||||
|
Assert.True((actual & PermissionMask.Copy) == 0, message);
|
||||||
|
|
||||||
|
if ((desired & PermissionMask.Modify) != 0)
|
||||||
|
Assert.True((actual & PermissionMask.Modify) != 0, message);
|
||||||
|
else
|
||||||
|
Assert.True((actual & PermissionMask.Modify) == 0, message);
|
||||||
|
|
||||||
|
if ((desired & PermissionMask.Transfer) != 0)
|
||||||
|
Assert.True((actual & PermissionMask.Transfer) != 0, message);
|
||||||
|
else
|
||||||
|
Assert.True((actual & PermissionMask.Transfer) == 0, message);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SceneObjectGroup AddSceneObject(string name, int suffix, int partsToTestCount, UUID ownerID)
|
||||||
|
{
|
||||||
|
SceneObjectGroup so = SceneHelpers.CreateSceneObject(partsToTestCount, ownerID, name, suffix);
|
||||||
|
so.Name = name;
|
||||||
|
so.Description = name;
|
||||||
|
|
||||||
|
Assert.That(m_Scene.AddNewSceneObject(so, false), Is.True);
|
||||||
|
SceneObjectGroup retrievedSo = m_Scene.GetSceneObjectGroup(so.UUID);
|
||||||
|
|
||||||
|
// If the parts have the same UUID then we will consider them as one and the same
|
||||||
|
Assert.That(retrievedSo.PrimCount, Is.EqualTo(partsToTestCount));
|
||||||
|
|
||||||
|
return so;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TakeCopyToInventory(int userIndex, SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, m_Avatars[userIndex].UUID, "Objects");
|
||||||
|
Assert.That(objsFolder, Is.Not.Null);
|
||||||
|
|
||||||
|
List<uint> localIds = new List<uint>(); localIds.Add(sog.LocalId);
|
||||||
|
// This is an async operation
|
||||||
|
m_Scene.DeRezObjects((IClientAPI)m_Avatars[userIndex].ClientView, localIds, m_Avatars[userIndex].UUID, DeRezAction.TakeCopy, objsFolder.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItemBase GetItemFromInventory(UUID userID, string folderName, string itemName)
|
||||||
|
{
|
||||||
|
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(m_Scene.InventoryService, userID, folderName);
|
||||||
|
Assert.That(objsFolder, Is.Not.Null);
|
||||||
|
List<InventoryItemBase> items = m_Scene.InventoryService.GetFolderItems(userID, objsFolder.ID);
|
||||||
|
InventoryItemBase item = items.Find(i => i.Name == itemName);
|
||||||
|
Assert.That(item, Is.Not.Null);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItemBase CloneInventoryItem(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
InventoryItemBase clone = new InventoryItemBase(item.ID);
|
||||||
|
clone.Name = item.Name;
|
||||||
|
clone.Description = item.Description;
|
||||||
|
clone.AssetID = item.AssetID;
|
||||||
|
clone.AssetType = item.AssetType;
|
||||||
|
clone.BasePermissions = item.BasePermissions;
|
||||||
|
clone.CreatorId = item.CreatorId;
|
||||||
|
clone.CurrentPermissions = item.CurrentPermissions;
|
||||||
|
clone.EveryOnePermissions = item.EveryOnePermissions;
|
||||||
|
clone.Flags = item.Flags;
|
||||||
|
clone.Folder = item.Folder;
|
||||||
|
clone.GroupID = item.GroupID;
|
||||||
|
clone.GroupOwned = item.GroupOwned;
|
||||||
|
clone.GroupPermissions = item.GroupPermissions;
|
||||||
|
clone.InvType = item.InvType;
|
||||||
|
clone.NextPermissions = item.NextPermissions;
|
||||||
|
clone.Owner = item.Owner;
|
||||||
|
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteObjectsFolders()
|
||||||
|
{
|
||||||
|
// Delete everything in A2 and A3's Objects folders, so we can restart
|
||||||
|
for (int i = 1; i < 3; i++)
|
||||||
|
{
|
||||||
|
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[i].UUID, "Objects");
|
||||||
|
Assert.That(objsFolder, Is.Not.Null);
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
|
||||||
|
List<UUID> ids = new List<UUID>();
|
||||||
|
foreach (InventoryItemBase it in items)
|
||||||
|
ids.Add(it.ID);
|
||||||
|
|
||||||
|
Common.TheScene.InventoryService.DeleteItems(Common.TheAvatars[i].UUID, ids);
|
||||||
|
items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
|
||||||
|
Assert.That(items.Count, Is.EqualTo(0), "A" + (i + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public string IdStr(InventoryItemBase item)
|
||||||
|
{
|
||||||
|
return item.Owner.ToString().Substring(34) + " : " + item.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string IdStr(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
return sog.OwnerID.ToString().Substring(34) + " : " + sog.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GiveInventoryItem(UUID itemId, ScenePresence giverSp, ScenePresence receiverSp)
|
||||||
|
{
|
||||||
|
TestClient giverClient = (TestClient)giverSp.ControllingClient;
|
||||||
|
TestClient receiverClient = (TestClient)receiverSp.ControllingClient;
|
||||||
|
|
||||||
|
UUID initialSessionId = TestHelpers.ParseTail(0x10);
|
||||||
|
byte[] giveImBinaryBucket = new byte[17];
|
||||||
|
byte[] itemIdBytes = itemId.GetBytes();
|
||||||
|
Array.Copy(itemIdBytes, 0, giveImBinaryBucket, 1, itemIdBytes.Length);
|
||||||
|
|
||||||
|
GridInstantMessage giveIm
|
||||||
|
= new GridInstantMessage(
|
||||||
|
m_Scene,
|
||||||
|
giverSp.UUID,
|
||||||
|
giverSp.Name,
|
||||||
|
receiverSp.UUID,
|
||||||
|
(byte)InstantMessageDialog.InventoryOffered,
|
||||||
|
false,
|
||||||
|
"inventory offered msg",
|
||||||
|
initialSessionId,
|
||||||
|
false,
|
||||||
|
Vector3.Zero,
|
||||||
|
giveImBinaryBucket,
|
||||||
|
true);
|
||||||
|
|
||||||
|
giverClient.HandleImprovedInstantMessage(giveIm);
|
||||||
|
|
||||||
|
// These details might not all be correct.
|
||||||
|
GridInstantMessage acceptIm
|
||||||
|
= new GridInstantMessage(
|
||||||
|
m_Scene,
|
||||||
|
receiverSp.UUID,
|
||||||
|
receiverSp.Name,
|
||||||
|
giverSp.UUID,
|
||||||
|
(byte)InstantMessageDialog.InventoryAccepted,
|
||||||
|
false,
|
||||||
|
"inventory accepted msg",
|
||||||
|
initialSessionId,
|
||||||
|
false,
|
||||||
|
Vector3.Zero,
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
|
||||||
|
receiverClient.HandleImprovedInstantMessage(acceptIm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||||
|
|
||||||
|
namespace OpenSim.Tests.Permissions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Basic scene object tests (create, read and delete but not update).
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture]
|
||||||
|
public class DirectTransferTests
|
||||||
|
{
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
Common.TheInstance.DeleteObjectsFolders();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test giving simple objecta with various combinations of next owner perms.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestGiveBox()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
// C, CT, MC, MCT, MT, T
|
||||||
|
string[] names = new string[6] { "Box C", "Box CT", "Box MC", "Box MCT", "Box MT", "Box T" };
|
||||||
|
PermissionMask[] perms = new PermissionMask[6] {
|
||||||
|
PermissionMask.Copy,
|
||||||
|
PermissionMask.Copy | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Modify | PermissionMask.Copy,
|
||||||
|
PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Modify | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Transfer
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
TestOneBox(names[i], perms[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TestOneBox(string name, PermissionMask mask)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[0].UUID, "Objects", name);
|
||||||
|
|
||||||
|
Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[0], Common.TheAvatars[1]);
|
||||||
|
|
||||||
|
item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name);
|
||||||
|
|
||||||
|
// Check the receiver
|
||||||
|
Common.TheInstance.PrintPerms(item);
|
||||||
|
Common.TheInstance.AssertPermissions(mask, (PermissionMask)item.BasePermissions, item.Owner.ToString().Substring(34) + " : " + item.Name);
|
||||||
|
|
||||||
|
int nObjects = Common.TheScene.GetSceneObjectGroups().Count;
|
||||||
|
// Rez it and check perms in scene too
|
||||||
|
Common.TheScene.RezObject(Common.TheAvatars[1].ControllingClient, item.ID, UUID.Zero, Vector3.One, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero);
|
||||||
|
Assert.That(Common.TheScene.GetSceneObjectGroups().Count, Is.EqualTo(nObjects + 1));
|
||||||
|
|
||||||
|
SceneObjectGroup box = Common.TheScene.GetSceneObjectGroups().Find(sog => sog.OwnerID == Common.TheAvatars[1].UUID && sog.Name == name);
|
||||||
|
Common.TheInstance.PrintPerms(box);
|
||||||
|
Assert.That(box, Is.Not.Null);
|
||||||
|
|
||||||
|
// Check Owner permissions
|
||||||
|
Common.TheInstance.AssertPermissions(mask, (PermissionMask)box.EffectiveOwnerPerms, box.OwnerID.ToString().Substring(34) + " : " + box.Name);
|
||||||
|
|
||||||
|
// Check Next Owner permissions
|
||||||
|
Common.TheInstance.AssertPermissions(mask, (PermissionMask)box.RootPart.NextOwnerMask, box.OwnerID.ToString().Substring(34) + " : " + box.Name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test giving simple objecta with variour combinations of next owner perms.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestDoubleGiveWithChange()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
string name = "Box MCT-C";
|
||||||
|
InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[0].UUID, "Objects", name);
|
||||||
|
|
||||||
|
// Now give the item to A2. We give the original item, not a clone.
|
||||||
|
// The giving methods are supposed to duplicate it.
|
||||||
|
Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[0], Common.TheAvatars[1]);
|
||||||
|
|
||||||
|
item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name);
|
||||||
|
|
||||||
|
// Check the receiver
|
||||||
|
Common.TheInstance.PrintPerms(item);
|
||||||
|
Common.TheInstance.AssertPermissions(PermissionMask.Modify | PermissionMask.Transfer,
|
||||||
|
(PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item));
|
||||||
|
|
||||||
|
// ---------------------------
|
||||||
|
// Second transfer
|
||||||
|
//----------------------------
|
||||||
|
|
||||||
|
// A2 revokes M
|
||||||
|
Common.TheInstance.RevokePermission(1, name, PermissionMask.Modify);
|
||||||
|
|
||||||
|
item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", name);
|
||||||
|
|
||||||
|
// Now give the item to A3. We give the original item, not a clone.
|
||||||
|
// The giving methods are supposed to duplicate it.
|
||||||
|
Common.TheInstance.GiveInventoryItem(item.ID, Common.TheAvatars[1], Common.TheAvatars[2]);
|
||||||
|
|
||||||
|
item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[2].UUID, "Objects", name);
|
||||||
|
|
||||||
|
// Check the receiver
|
||||||
|
Common.TheInstance.PrintPerms(item);
|
||||||
|
Common.TheInstance.AssertPermissions(PermissionMask.Transfer,
|
||||||
|
(PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using PermissionMask = OpenSim.Framework.PermissionMask;
|
||||||
|
|
||||||
|
namespace OpenSim.Tests.Permissions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Basic scene object tests (create, read and delete but not update).
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture]
|
||||||
|
public class IndirectTransferTests
|
||||||
|
{
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
Common.TheInstance.DeleteObjectsFolders();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test giving simple objecta with various combinations of next owner perms.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void SimpleTakeCopy()
|
||||||
|
{
|
||||||
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
|
// The Objects folder of A2
|
||||||
|
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[1].UUID, "Objects");
|
||||||
|
|
||||||
|
// C, CT, MC, MCT, MT, T
|
||||||
|
string[] names = new string[6] { "Box C", "Box CT", "Box MC", "Box MCT", "Box MT", "Box T" };
|
||||||
|
PermissionMask[] perms = new PermissionMask[6] {
|
||||||
|
PermissionMask.Copy,
|
||||||
|
PermissionMask.Copy | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Modify | PermissionMask.Copy,
|
||||||
|
PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Modify | PermissionMask.Transfer,
|
||||||
|
PermissionMask.Transfer
|
||||||
|
};
|
||||||
|
|
||||||
|
// Try A2 takes copies of objects that cannot be copied.
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
TakeOneBox(Common.TheScene.GetSceneObjectGroups(), names[i], perms[i]);
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
|
List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[1].UUID, objsFolder.ID);
|
||||||
|
Assert.That(items.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// A1 makes the objects copyable
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
MakeCopyable(Common.TheScene.GetSceneObjectGroups(), names[i]);
|
||||||
|
|
||||||
|
// Try A2 takes copies of objects that can be copied.
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
TakeOneBox(Common.TheScene.GetSceneObjectGroups(), names[i], perms[i]);
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
|
||||||
|
items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[1].UUID, objsFolder.ID);
|
||||||
|
Assert.That(items.Count, Is.EqualTo(6));
|
||||||
|
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
InventoryItemBase item = Common.TheInstance.GetItemFromInventory(Common.TheAvatars[1].UUID, "Objects", names[i]);
|
||||||
|
Assert.That(item, Is.Not.Null);
|
||||||
|
Common.TheInstance.AssertPermissions(perms[i], (PermissionMask)item.BasePermissions, Common.TheInstance.IdStr(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TakeOneBox(List<SceneObjectGroup> objs, string name, PermissionMask mask)
|
||||||
|
{
|
||||||
|
SceneObjectGroup box = objs.Find(sog => sog.Name == name && sog.OwnerID == Common.TheAvatars[0].UUID);
|
||||||
|
Assert.That(box, Is.Not.Null, name);
|
||||||
|
|
||||||
|
// A2's inventory (index 1)
|
||||||
|
Common.TheInstance.TakeCopyToInventory(1, box);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MakeCopyable(List<SceneObjectGroup> objs, string name)
|
||||||
|
{
|
||||||
|
SceneObjectGroup box = objs.Find(sog => sog.Name == name && sog.OwnerID == Common.TheAvatars[0].UUID);
|
||||||
|
Assert.That(box, Is.Not.Null, name);
|
||||||
|
|
||||||
|
// field = 8 is Everyone
|
||||||
|
// set = 1 means add the permission; set = 0 means remove permission
|
||||||
|
Common.TheScene.HandleObjectPermissionsUpdate((IClientAPI)Common.TheAvatars[0].ClientView, Common.TheAvatars[0].UUID,
|
||||||
|
Common.TheAvatars[0].ControllingClient.SessionId, 8, box.LocalId, (uint)PermissionMask.Copy, 1);
|
||||||
|
Common.TheInstance.PrintPerms(box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
bin/CSJ2K.dll
BIN
bin/CSJ2K.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -49,19 +49,13 @@
|
||||||
; this section defines constants for grid services
|
; this section defines constants for grid services
|
||||||
; to simplify other configuration files default settings
|
; to simplify other configuration files default settings
|
||||||
|
|
||||||
; BaseURL
|
;# {BaseHostname} {} {BaseHostname} {"example.com" "127.0.0.1"} "127.0.0.1"
|
||||||
; should be the externally accessible IP/DNS name of grid or standalone
|
BaseHostname = "127.0.0.1"
|
||||||
; http://externalHostName or https://externalHostName if using ssl
|
|
||||||
; examples: http://mymachine.example.com, https://mymachine.example.com, https://127.0.0.1
|
|
||||||
; default: http://127.0.0.1
|
|
||||||
;# {BaseURL} {} {BaseURL} {"http://example.com" "http://127.0.0.1"} ""
|
|
||||||
BaseURL = http://127.0.0.1
|
|
||||||
|
|
||||||
; default public port
|
;# {BaseURL} {} {BaseURL} {"http://${Const|BaseHostname}} "http://${Const|BaseHostname}"
|
||||||
; usually 8002 for grids.
|
BaseURL = http://${Const|BaseHostname}
|
||||||
; on standalones it needs to match http_listener_port or http_listener_sslport if using ssl
|
|
||||||
; in [Network] section below (defaults 9000 or 9001 if using ssl)
|
;# {PublicPort} {} {PublicPort} {8002 9000} "8002"
|
||||||
;# {PublicPort} {} {PublicPort} {8002 9000 9001} "8002"
|
|
||||||
PublicPort = "8002"
|
PublicPort = "8002"
|
||||||
|
|
||||||
;grid default private port 8003, not used in standalone
|
;grid default private port 8003, not used in standalone
|
||||||
|
@ -569,9 +563,8 @@
|
||||||
|
|
||||||
;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {}
|
;# {ExternalHostNameForLSL} {} {Hostname to use for HTTP-IN URLs. This should be reachable from the internet.} {}
|
||||||
;; Hostname to use in llRequestURL/llRequestSecureURL
|
;; Hostname to use in llRequestURL/llRequestSecureURL
|
||||||
;; if not defined - default machine name is being used
|
;; if not defined - llRequestURL/llRequestSecureURL are disabled
|
||||||
;; (on Windows this mean NETBIOS name - useably only inside local network)
|
ExternalHostNameForLSL = ${Const|BaseHostname}
|
||||||
; ExternalHostNameForLSL = "127.0.0.1"
|
|
||||||
|
|
||||||
;# {shard} {} {Name to use for X-Secondlife-Shard header? (press enter if unsure)} {} OpenSim
|
;# {shard} {} {Name to use for X-Secondlife-Shard header? (press enter if unsure)} {} OpenSim
|
||||||
;; What is reported as the "X-Secondlife-Shard"
|
;; What is reported as the "X-Secondlife-Shard"
|
||||||
|
|
|
@ -614,8 +614,7 @@
|
||||||
|
|
||||||
; Hostname to use in llRequestURL/llRequestSecureURL
|
; Hostname to use in llRequestURL/llRequestSecureURL
|
||||||
; must be a valid hostname for the ssl cert.
|
; must be a valid hostname for the ssl cert.
|
||||||
; if not defined - default machine name is being used
|
; if not defined - llRequestURL/llRequestSecureURL are disabled
|
||||||
; (on Windows this mean NETBIOS name - useably only inside local network)
|
|
||||||
; ExternalHostNameForLSL=127.0.0.1
|
; ExternalHostNameForLSL=127.0.0.1
|
||||||
|
|
||||||
; Disallow the following address ranges for user scripting calls (e.g. llHttpRequest())
|
; Disallow the following address ranges for user scripting calls (e.g. llHttpRequest())
|
||||||
|
@ -1913,7 +1912,8 @@
|
||||||
|
|
||||||
; regex specifying for which regions concierge service is desired; if
|
; regex specifying for which regions concierge service is desired; if
|
||||||
; empty, then for all
|
; empty, then for all
|
||||||
regions = "^MeetingSpace-"
|
;regions = "^MeetingSpace-"
|
||||||
|
regions = ""
|
||||||
|
|
||||||
; for each region that matches the regions regexp you can provide
|
; for each region that matches the regions regexp you can provide
|
||||||
; (optionally) a welcome template using format substitution:
|
; (optionally) a welcome template using format substitution:
|
||||||
|
@ -1921,14 +1921,14 @@
|
||||||
; {1} is replaced with the name of the region
|
; {1} is replaced with the name of the region
|
||||||
; {2} is replaced with the name of the concierge (whoami variable above)
|
; {2} is replaced with the name of the concierge (whoami variable above)
|
||||||
|
|
||||||
welcomes = /path/to/welcome/template/directory
|
;welcomes = /path/to/welcome/template/directory
|
||||||
|
|
||||||
; Concierge can send attendee lists to an event broker whenever an
|
; Concierge can send attendee lists to an event broker whenever an
|
||||||
; avatar enters or leaves a concierged region. the URL is subject
|
; avatar enters or leaves a concierged region. the URL is subject
|
||||||
; to format substitution:
|
; to format substitution:
|
||||||
; {0} is replaced with the region's name
|
; {0} is replaced with the region's name
|
||||||
; {1} is replaced with the region's UUID
|
; {1} is replaced with the region's UUID
|
||||||
broker = "http://broker.place.com/{1}"
|
;broker = "http://broker.place.com/{1}"
|
||||||
|
|
||||||
|
|
||||||
[MRM]
|
[MRM]
|
||||||
|
|
39
prebuild.xml
39
prebuild.xml
|
@ -3300,6 +3300,45 @@
|
||||||
</Files>
|
</Files>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
||||||
|
<Project frameworkVersion="v4_0" name="OpenSim.Tests.Permissions" path="OpenSim/Tests/Permissions" type="Library">
|
||||||
|
<Configuration name="Debug">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration name="Release">
|
||||||
|
<Options>
|
||||||
|
<OutputPath>../../../bin/</OutputPath>
|
||||||
|
</Options>
|
||||||
|
</Configuration>
|
||||||
|
|
||||||
|
<ReferencePath>../../../bin/</ReferencePath>
|
||||||
|
<Reference name="System"/>
|
||||||
|
<Reference name="System.Core"/>
|
||||||
|
<Reference name="System.Xml"/>
|
||||||
|
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||||
|
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||||
|
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||||
|
<Reference name="OpenSim"/>
|
||||||
|
<Reference name="OpenSim.ApplicationPlugins.RegionModulesController"/>
|
||||||
|
<Reference name="OpenSim.Framework"/>
|
||||||
|
<Reference name="OpenSim.Region.Framework"/>
|
||||||
|
<Reference name="OpenSim.Region.CoreModules"/>
|
||||||
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
|
|
||||||
|
<!-- Unit tests -->
|
||||||
|
<!-- <Reference name="OpenSim.Tests.Common"/> -->
|
||||||
|
<Reference name="OpenSim.Tests.Common"/>
|
||||||
|
<Reference name="Nini" path="../../../bin/"/>
|
||||||
|
<Reference name="nunit.framework" path="../../../bin/"/>
|
||||||
|
|
||||||
|
<Reference name="log4net" path="../../../bin/"/>
|
||||||
|
|
||||||
|
<Files>
|
||||||
|
<Match pattern="*.cs" recurse="false"/>
|
||||||
|
</Files>
|
||||||
|
</Project>
|
||||||
|
|
||||||
<?include file="addon-modules/*/prebuild*.xml" ?>
|
<?include file="addon-modules/*/prebuild*.xml" ?>
|
||||||
|
|
||||||
</Solution>
|
</Solution>
|
||||||
|
|
Loading…
Reference in New Issue