Committing patch from Melanie. 0001290: [PATCH] implement permissions propagation and script module hooks. Thanks Melanie!
* Implements quite a few inventory related perms. * (from Teravus) Fixes Take Copy0.6.0-stable
parent
4ff4475d02
commit
d60e457463
|
@ -4528,7 +4528,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
handlerObjectPermissions = OnObjectPermissions;
|
||||
|
||||
if (handlerObjectPermissions != null)
|
||||
OnObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
|
||||
handlerObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
//Register functions with Scene External Checks!
|
||||
m_scene.ExternalChecks.addBypassPermissions(BypassPermissions); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addSetBypassPermissions(SetBypassPermissions); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addPropagatePermissions(PropagatePermissions); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckAbandonParcel(CanAbandonParcel); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addGenerateClientFlags(GenerateClientFlags); //NOT YET FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckBeGodLike(CanBeGodLike); //FULLY IMPLEMENTED
|
||||
|
@ -251,6 +252,11 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
}
|
||||
#endregion
|
||||
|
||||
public bool PropagatePermissions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool BypassPermissions()
|
||||
{
|
||||
return m_bypassPermissions;
|
||||
|
@ -813,7 +819,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
bool permission = GenericObjectPermission(userID, objectID,false);
|
||||
if (permission)
|
||||
if (!permission)
|
||||
{
|
||||
if (!m_scene.Entities.ContainsKey(objectID))
|
||||
{
|
||||
|
|
|
@ -1339,11 +1339,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanEditObject(objid, user))
|
||||
{
|
||||
obj.AddFlag(LLObject.ObjectFlags.JointWheel);
|
||||
obj.ParentGroup.RootPart.AddFlag(LLObject.ObjectFlags.JointWheel);
|
||||
}
|
||||
else if (!IncludeInSearch && m_parentScene.ExternalChecks.ExternalChecksCanMoveObject(objid,user))
|
||||
{
|
||||
obj.RemFlag(LLObject.ObjectFlags.JointWheel);
|
||||
obj.ParentGroup.RootPart.RemFlag(LLObject.ObjectFlags.JointWheel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
item.Name = itemUpd.Name;
|
||||
item.Description = itemUpd.Description;
|
||||
item.NextPermissions = itemUpd.NextPermissions;
|
||||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions;
|
||||
|
||||
// TODO: Requires sanity checks
|
||||
|
@ -348,6 +349,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (item != null)
|
||||
{
|
||||
if (!ExternalChecks.ExternalChecksBypassPermissions())
|
||||
{
|
||||
if((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO get recipient's root folder
|
||||
CachedUserInfo recipientUserInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId);
|
||||
|
@ -365,12 +372,37 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
itemCopy.AssetType = item.AssetType;
|
||||
itemCopy.InvType = item.InvType;
|
||||
itemCopy.Folder = recipientUserInfo.RootFolder.ID;
|
||||
itemCopy.CurrentPermissions = 2147483647;
|
||||
itemCopy.NextPermissions = 2147483647;
|
||||
itemCopy.EveryOnePermissions = item.EveryOnePermissions;
|
||||
itemCopy.BasePermissions = item.BasePermissions;
|
||||
itemCopy.CurrentPermissions = item.CurrentPermissions;
|
||||
if (ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
if(item.InvType == 6)
|
||||
{
|
||||
itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Non-Prim item ==>");
|
||||
itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions;
|
||||
}
|
||||
|
||||
itemCopy.CurrentPermissions = itemCopy.BasePermissions;
|
||||
if((item.CurrentPermissions & 8) != 0) // Propagate slam bit
|
||||
{
|
||||
itemCopy.CurrentPermissions = item.NextPermissions;
|
||||
itemCopy.BasePermissions=itemCopy.CurrentPermissions;
|
||||
itemCopy.CurrentPermissions |= 8;
|
||||
}
|
||||
|
||||
itemCopy.NextPermissions = item.NextPermissions;
|
||||
itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemCopy.CurrentPermissions = item.CurrentPermissions;
|
||||
itemCopy.NextPermissions = item.NextPermissions;
|
||||
itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions;
|
||||
itemCopy.BasePermissions = item.BasePermissions;
|
||||
}
|
||||
itemCopy.GroupID = item.GroupID;
|
||||
itemCopy.GroupOwned = item.GroupOwned;
|
||||
itemCopy.Flags = item.Flags;
|
||||
|
@ -379,6 +411,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
recipientUserInfo.AddItem(itemCopy);
|
||||
|
||||
if (!ExternalChecks.ExternalChecksBypassPermissions())
|
||||
{
|
||||
if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
senderUserInfo.DeleteItem(itemId);
|
||||
}
|
||||
|
||||
// Let the recipient client know about this new item
|
||||
recipientClient.SendBulkUpdateInventory(itemCopy);
|
||||
}
|
||||
|
@ -446,9 +484,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (asset != null)
|
||||
{
|
||||
// TODO: preserve current permissions?
|
||||
if(remoteClient.AgentId == oldAgentID)
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, newFolderID, callbackID, asset, item.NextPermissions);
|
||||
remoteClient, newFolderID, callbackID, asset, item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateNewInventoryItem(
|
||||
remoteClient, newFolderID, callbackID, asset, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -507,7 +552,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
userInfo.DeleteItem(item.ID);
|
||||
|
||||
// TODO: preserve current permissions?
|
||||
AddInventoryItem(remoteClient, item);
|
||||
}
|
||||
else
|
||||
|
@ -525,6 +569,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
|
||||
AssetBase asset, uint nextOwnerMask)
|
||||
{
|
||||
CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask, nextOwnerMask, 0, nextOwnerMask);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new inventory item.
|
||||
/// </summary>
|
||||
|
@ -534,7 +584,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="asset"></param>
|
||||
/// <param name="nextOwnerMask"></param>
|
||||
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
|
||||
AssetBase asset, uint nextOwnerMask)
|
||||
AssetBase asset, uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
@ -551,8 +601,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
item.AssetType = asset.Type;
|
||||
item.InvType = asset.InvType;
|
||||
item.Folder = folderID;
|
||||
item.CurrentPermissions = 2147483647;
|
||||
item.CurrentPermissions = currentMask;
|
||||
item.NextPermissions = nextOwnerMask;
|
||||
item.EveryOnePermissions = everyoneMask;
|
||||
item.BasePermissions = baseMask;
|
||||
|
||||
userInfo.AddItem(item);
|
||||
remoteClient.SendInventoryItemCreateUpdate(item);
|
||||
|
@ -766,9 +818,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="itemID"></param>
|
||||
public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
|
||||
{
|
||||
SceneObjectGroup group = GetGroupByPrim(primLocalId);
|
||||
SceneObjectPart part = GetSceneObjectPart(primLocalId);
|
||||
|
||||
if (null == group)
|
||||
if (null == part)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
|
@ -778,7 +830,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem taskItem = group.GetInventoryItem(primLocalId, itemId);
|
||||
TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
|
||||
|
||||
if (null == taskItem)
|
||||
{
|
||||
|
@ -786,19 +838,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
// bool permission;
|
||||
// permission = Permissions.CanCopyObject(remoteClient.AgentId,
|
||||
// ((SceneObjectGroup) selectedEnt).UUID);
|
||||
|
||||
// Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
|
||||
// to copy
|
||||
// Only owner can copy
|
||||
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[PRIM INVENTORY]: Attempt made by {0} {1} to copy inventory item {2} {3} in prim {4} {5},"
|
||||
+ " but temporarily not allowed pending upstream bugfixes/feature implementation",
|
||||
remoteClient.Name, remoteClient.AgentId, taskItem.Name, taskItem.ItemID, group.Name, group.UUID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -813,22 +855,29 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
agentItem.AssetType = taskItem.Type;
|
||||
agentItem.InvType = taskItem.InvType;
|
||||
agentItem.Folder = folderId;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryoneMask;
|
||||
|
||||
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||
if ((remoteClient.AgentId != taskItem.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
agentItem.BasePermissions = taskItem.NextOwnerMask;
|
||||
agentItem.CurrentPermissions = taskItem.NextOwnerMask;
|
||||
agentItem.NextPermissions = taskItem.NextOwnerMask;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryoneMask & taskItem.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
agentItem.BasePermissions = taskItem.BaseMask;
|
||||
agentItem.CurrentPermissions = taskItem.OwnerMask;
|
||||
agentItem.NextPermissions = taskItem.NextOwnerMask;
|
||||
agentItem.EveryOnePermissions = taskItem.EveryoneMask;
|
||||
}
|
||||
|
||||
AddInventoryItem(remoteClient, agentItem);
|
||||
if (!ExternalChecks.ExternalChecksBypassPermissions())
|
||||
{
|
||||
if((taskItem.OwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
part.RemoveInventoryItem(itemId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -842,9 +891,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID,
|
||||
uint primLocalID)
|
||||
{
|
||||
SceneObjectGroup group = GetGroupByPrim(primLocalID);
|
||||
SceneObjectPart part = GetSceneObjectPart(primLocalID);
|
||||
|
||||
if (group != null)
|
||||
if (part != null)
|
||||
{
|
||||
LLUUID copyID = LLUUID.Random();
|
||||
if (itemID != LLUUID.Zero)
|
||||
|
@ -864,11 +913,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (item != null)
|
||||
{
|
||||
group.AddInventoryItem(remoteClient, primLocalID, item, copyID);
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
|
||||
m_log.InfoFormat(
|
||||
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
||||
item.Name, primLocalID, remoteClient.Name);
|
||||
group.GetProperties(remoteClient);
|
||||
part.ParentGroup.GetProperties(remoteClient);
|
||||
if (!ExternalChecks.ExternalChecksBypassPermissions())
|
||||
{
|
||||
if((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
RemoveInventoryItem(remoteClient, itemID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -915,12 +969,12 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (item != null)
|
||||
{
|
||||
SceneObjectGroup group = GetGroupByPrim(localID);
|
||||
if (group != null)
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null)
|
||||
{
|
||||
group.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||
group.StartScript(localID, copyID);
|
||||
group.GetProperties(remoteClient);
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||
part.ParentGroup.StartScript(localID, copyID);
|
||||
part.ParentGroup.GetProperties(remoteClient);
|
||||
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
|
@ -1038,18 +1092,21 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
item.AssetType = asset.Type;
|
||||
item.InvType = asset.InvType;
|
||||
item.Folder = DeRezPacket.AgentBlock.DestinationID;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
|
||||
if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
objectGroup.ApplyNextOwnerPermissions();
|
||||
|
||||
item.BasePermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = objectGroup.GetEffectivePermissions() & objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.BaseMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
|
||||
item.BasePermissions = objectGroup.GetEffectivePermissions();
|
||||
item.CurrentPermissions = objectGroup.GetEffectivePermissions();
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
}
|
||||
|
||||
// TODO: add the new fields (Flags, Sale info, etc)
|
||||
|
@ -1068,6 +1125,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
|
||||
{
|
||||
SceneObjectGroup objectGroup = grp;
|
||||
|
@ -1130,18 +1188,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// Sticking it in root folder for now.. objects folder later?
|
||||
|
||||
item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
if (agentID != objectGroup.RootPart.OwnerID)
|
||||
if ((agentID != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.BaseMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
|
||||
item.BasePermissions = objectGroup.GetEffectivePermissions();
|
||||
item.CurrentPermissions = objectGroup.GetEffectivePermissions();
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
}
|
||||
|
||||
userInfo.AddItem(item);
|
||||
|
@ -1187,18 +1246,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// Sticking it in root folder for now.. objects folder later?
|
||||
|
||||
item.Folder = userInfo.RootFolder.ID;// DeRezPacket.AgentBlock.DestinationID;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
if (remoteClient.AgentId != objectGroup.RootPart.OwnerID)
|
||||
if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BasePermissions = objectGroup.RootPart.BaseMask;
|
||||
item.CurrentPermissions = objectGroup.RootPart.OwnerMask;
|
||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
||||
}
|
||||
|
||||
userInfo.AddItem(item);
|
||||
|
@ -1344,18 +1404,33 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
rootPart.Description = item.Description;
|
||||
|
||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
||||
|
||||
if(rootPart.OwnerID != item.Owner)
|
||||
{
|
||||
if((item.CurrentPermissions & 8) != 0)
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
}
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.Owner)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.Owner;
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.BaseMask = item.BasePermissions;
|
||||
part.OwnerMask = item.CurrentPermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
part.ChangeInventoryOwner(item.Owner);
|
||||
}
|
||||
else if(((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
|
||||
{
|
||||
part.EveryoneMask = item.EveryOnePermissions;
|
||||
part.NextOwnerMask = item.NextPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
rootPart.TrimPermissions();
|
||||
|
@ -1421,18 +1496,33 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
rootPart.Description = item.Description;
|
||||
|
||||
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
|
||||
|
||||
if(rootPart.OwnerID != item.OwnerID)
|
||||
{
|
||||
if((item.OwnerMask & 8) != 0)
|
||||
{
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
part.EveryoneMask = item.EveryoneMask;
|
||||
part.NextOwnerMask = item.NextOwnerMask;
|
||||
}
|
||||
}
|
||||
group.ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
||||
foreach (SceneObjectPart part in partList)
|
||||
{
|
||||
if (part.OwnerID != item.OwnerID)
|
||||
{
|
||||
part.LastOwnerID = part.OwnerID;
|
||||
part.OwnerID = item.OwnerID;
|
||||
part.EveryoneMask = item.EveryoneMask;
|
||||
part.BaseMask = item.BaseMask;
|
||||
part.OwnerMask = item.OwnerMask;
|
||||
part.NextOwnerMask = item.NextOwnerMask;
|
||||
part.ChangeInventoryOwner(item.OwnerID);
|
||||
}
|
||||
else if((item.OwnerMask & 8) != 0) // Slam!
|
||||
{
|
||||
part.EveryoneMask = item.EveryoneMask;
|
||||
part.NextOwnerMask = item.NextOwnerMask;
|
||||
}
|
||||
}
|
||||
rootPart.TrimPermissions();
|
||||
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
|
||||
|
|
|
@ -61,7 +61,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public uint ExternalChecksGenerateClientFlags(LLUUID userID, LLUUID objectID)
|
||||
{
|
||||
uint perms=(uint)2147483647;
|
||||
SceneObjectPart part=m_scene.GetSceneObjectPart(objectID);
|
||||
|
||||
uint perms=part.GetEffectiveObjectFlags() |
|
||||
(uint)LLObject.ObjectFlags.ObjectModify |
|
||||
(uint)LLObject.ObjectFlags.ObjectCopy |
|
||||
(uint)LLObject.ObjectFlags.ObjectMove |
|
||||
(uint)LLObject.ObjectFlags.ObjectTransfer |
|
||||
(uint)LLObject.ObjectFlags.ObjectYouOwner |
|
||||
(uint)LLObject.ObjectFlags.ObjectYouOfficer;
|
||||
|
||||
foreach (GenerateClientFlags check in GenerateClientFlagsCheckFunctions)
|
||||
{
|
||||
perms &= check(userID, objectID);
|
||||
|
@ -117,6 +126,32 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public delegate bool PropagatePermissions();
|
||||
private List<PropagatePermissions> PropagatePermissionsCheckFunctions = new List<PropagatePermissions>();
|
||||
|
||||
public void addPropagatePermissions(PropagatePermissions delegateFunc)
|
||||
{
|
||||
if (!PropagatePermissionsCheckFunctions.Contains(delegateFunc))
|
||||
PropagatePermissionsCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removePropagatePermissions(PropagatePermissions delegateFunc)
|
||||
{
|
||||
if (PropagatePermissionsCheckFunctions.Contains(delegateFunc))
|
||||
PropagatePermissionsCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksPropagatePermissions()
|
||||
{
|
||||
foreach (PropagatePermissions check in PropagatePermissionsCheckFunctions)
|
||||
{
|
||||
if (check() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region REZ OBJECT
|
||||
public delegate bool CanRezObject(int objectCount, LLUUID owner, LLVector3 objectPosition, Scene scene);
|
||||
private List<CanRezObject> CanRezObjectCheckFunctions = new List<CanRezObject>();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using libsecondlife;
|
||||
using log4net;
|
||||
|
@ -282,5 +283,38 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public uint GetEffectivePermissions()
|
||||
{
|
||||
uint perms=(uint)(PermissionMask.Modify |
|
||||
PermissionMask.Copy |
|
||||
PermissionMask.Move |
|
||||
PermissionMask.Transfer) | 7;
|
||||
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
perms &= part.MaskEffectivePermissions();
|
||||
|
||||
if((RootPart.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~(uint)PermissionMask.Modify;
|
||||
if((RootPart.OwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~(uint)PermissionMask.Copy;
|
||||
if((RootPart.OwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~(uint)PermissionMask.Transfer;
|
||||
|
||||
if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
perms &= ~((uint)PermissionMask.Modify >> 13);
|
||||
if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
perms &= ~((uint)PermissionMask.Copy >> 13);
|
||||
if((RootPart.OwnerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
perms &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
||||
public void ApplyNextOwnerPermissions()
|
||||
{
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
part.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1352,7 +1352,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
// Apply Next Owner Permissions if we're not bypassing permissions
|
||||
if (!m_scene.ExternalChecks.ExternalChecksBypassPermissions())
|
||||
m_rootPart.ApplyNextOwnerPermissions();
|
||||
ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
||||
part.ScheduleFullUpdate();
|
||||
|
|
|
@ -43,19 +43,14 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
private string m_inventoryFileName = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The inventory folder for this prim
|
||||
/// </summary>
|
||||
private LLUUID m_folderID = LLUUID.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Exposing this is not particularly good, but it's one of the least evils at the moment to see
|
||||
/// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
|
||||
/// </summary>
|
||||
public LLUUID FolderID
|
||||
{
|
||||
get { return m_folderID; }
|
||||
set { m_folderID = value; }
|
||||
get { return UUID; }
|
||||
set { } // Don't allow assignment, or legacy prims wil b0rk
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -133,8 +128,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
item.LastOwnerID = item.OwnerID;
|
||||
item.OwnerID = ownerId;
|
||||
item.BaseMask = item.NextOwnerMask & (uint)PermissionMask.All;
|
||||
item.OwnerMask = item.NextOwnerMask & (uint)PermissionMask.All;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="item"></param>
|
||||
public void AddInventoryItem(TaskInventoryItem item)
|
||||
{
|
||||
item.ParentID = m_folderID;
|
||||
item.ParentID = UUID;
|
||||
item.CreationDate = 1000;
|
||||
item.ParentPartID = UUID;
|
||||
|
||||
|
@ -486,7 +479,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches
|
||||
// what appears to happen in the Second Life protocol. If this isn't the case. then various functionality
|
||||
// isn't available (such as drag from prim inventory to agent inventory)
|
||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, LLUUID.Zero);
|
||||
InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero);
|
||||
|
||||
lock (m_taskInventory)
|
||||
{
|
||||
|
@ -494,26 +487,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
invString.AddItemStart();
|
||||
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
||||
invString.AddNameValueLine("parent_id", m_folderID.ToString());
|
||||
invString.AddNameValueLine("parent_id", UUID.ToString());
|
||||
|
||||
invString.AddPermissionsStart();
|
||||
|
||||
// FIXME: Temporary until permissions are properly sorted.
|
||||
invString.AddNameValueLine("base_mask", "7fffffff");
|
||||
invString.AddNameValueLine("owner_mask", "7fffffff");
|
||||
invString.AddNameValueLine("group_mask", "7fffffff");
|
||||
invString.AddNameValueLine("everyone_mask", "7fffffff");
|
||||
invString.AddNameValueLine("next_owner_mask", "7fffffff");
|
||||
|
||||
// invString.AddNameValueLine("group_mask", "00000000");
|
||||
// invString.AddNameValueLine("everyone_mask", "00000000");
|
||||
// invString.AddNameValueLine("next_owner_mask", "00086000");
|
||||
|
||||
// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
|
||||
// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
|
||||
// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask));
|
||||
// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask));
|
||||
// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
|
||||
invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
|
||||
invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
|
||||
invString.AddNameValueLine("group_mask", "00000000");
|
||||
invString.AddNameValueLine("everyone_mask", "00000000");
|
||||
invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
|
||||
|
||||
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
||||
invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
|
||||
|
@ -538,8 +520,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
invString.AddNameValueLine("desc", item.Description + "|");
|
||||
|
||||
invString.AddNameValueLine("creation_date", item.CreationDate.ToString());
|
||||
// invString.AddNameValueLine("creation_date", "1209151453");
|
||||
|
||||
invString.AddSectionEnd();
|
||||
}
|
||||
}
|
||||
|
@ -629,5 +609,65 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
public uint MaskEffectivePermissions()
|
||||
{
|
||||
uint mask=0x7fffffff;
|
||||
|
||||
foreach (TaskInventoryItem item in m_taskInventory.Values)
|
||||
{
|
||||
if(item.InvType != 6)
|
||||
{
|
||||
if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
||||
if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
||||
}
|
||||
else
|
||||
{
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
||||
mask &= ~((uint)PermissionMask.Transfer >> 13);
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||
mask &= ~((uint)PermissionMask.Modify >> 13);
|
||||
}
|
||||
|
||||
if((item.OwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
mask &= ~(uint)PermissionMask.Copy;
|
||||
if((item.OwnerMask & (uint)PermissionMask.Transfer) == 0)
|
||||
mask &= ~(uint)PermissionMask.Transfer;
|
||||
if((item.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
mask &= ~(uint)PermissionMask.Modify;
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
public void ApplyNextOwnerPermissions()
|
||||
{
|
||||
BaseMask &= NextOwnerMask;
|
||||
OwnerMask &= NextOwnerMask;
|
||||
EveryoneMask &= NextOwnerMask;
|
||||
|
||||
foreach (TaskInventoryItem item in m_taskInventory.Values)
|
||||
{
|
||||
if(item.InvType == 6)
|
||||
{
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||
item.OwnerMask &= ~(uint)PermissionMask.Copy;
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0)
|
||||
item.OwnerMask &= ~(uint)PermissionMask.Transfer;
|
||||
if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0)
|
||||
item.OwnerMask &= ~(uint)PermissionMask.Modify;
|
||||
}
|
||||
item.OwnerMask &= item.NextOwnerMask;
|
||||
item.BaseMask &= item.NextOwnerMask;
|
||||
item.EveryoneMask &= item.NextOwnerMask;
|
||||
}
|
||||
|
||||
TriggerScriptChangedEvent(Changed.OWNER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -813,11 +813,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
|
||||
m_folderID = UUID;
|
||||
|
||||
Flags = 0;
|
||||
Flags |= LLObject.ObjectFlags.AllowInventoryDrop |
|
||||
LLObject.ObjectFlags.CreateSelected;
|
||||
Flags |= LLObject.ObjectFlags.CreateSelected;
|
||||
|
||||
TrimPermissions();
|
||||
//m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
|
||||
|
@ -877,9 +875,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <returns></returns>
|
||||
public static SceneObjectPart FromXml(XmlReader xmlReader)
|
||||
{
|
||||
// It's not necessary to persist this
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
|
||||
SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
|
||||
|
||||
return newobject;
|
||||
}
|
||||
|
||||
|
@ -913,15 +912,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void ApplyNextOwnerPermissions()
|
||||
{
|
||||
BaseMask = NextOwnerMask;
|
||||
OwnerMask = NextOwnerMask;
|
||||
|
||||
TriggerScriptChangedEvent(Changed.OWNER);
|
||||
|
||||
}
|
||||
|
||||
public void TrimPermissions()
|
||||
{
|
||||
|
||||
|
@ -2541,7 +2531,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
info.AddValue("m_inventoryFileName", m_inventoryFileName);
|
||||
info.AddValue("m_folderID", m_folderID.UUID);
|
||||
info.AddValue("m_folderID", UUID);
|
||||
info.AddValue("PhysActor", PhysActor);
|
||||
|
||||
Dictionary<Guid, TaskInventoryItem> TaskInventory_work = new Dictionary<Guid, TaskInventoryItem>();
|
||||
|
|
Loading…
Reference in New Issue