Export permission, part two. Setting export perms for textures and clothing works. Setting perms for prims also works but they don't propagate correctly yet.
NOT FOR PRODUCTIN USE. Your database will need to be updated before you can use this!avinationmerge
parent
c341664c1b
commit
4bf9c4bbb8
|
@ -413,18 +413,57 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid
|
||||
{
|
||||
// Create a set of base permissions that will not include export if the user
|
||||
// is not allowed to change the export flag.
|
||||
bool denyExportChange = false;
|
||||
|
||||
m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
|
||||
|
||||
// If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export
|
||||
if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner)
|
||||
denyExportChange = true;
|
||||
|
||||
m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange);
|
||||
|
||||
// If it is already set, force it set and also force full perm
|
||||
// else prevent setting it. It can and should never be set unless
|
||||
// set in base, so the condition above is valid
|
||||
if (denyExportChange)
|
||||
{
|
||||
// If we are not allowed to change it, then force it to the
|
||||
// original item's setting and if it was on, also force full perm
|
||||
if ((item.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
|
||||
{
|
||||
itemUpd.NextPermissions = (uint)(PermissionMask.All);
|
||||
itemUpd.EveryOnePermissions |= (uint)PermissionMask.Export;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemUpd.EveryOnePermissions &= ~(uint)PermissionMask.Export;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the new state is exportable, force full perm
|
||||
if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
|
||||
{
|
||||
m_log.InfoFormat("[XXX]: Force full perm");
|
||||
itemUpd.NextPermissions = (uint)(PermissionMask.All);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
|
||||
item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
|
||||
|
||||
if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
|
||||
item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
|
||||
|
||||
if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
|
||||
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
|
||||
|
||||
// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
|
||||
|
||||
item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
|
||||
|
||||
item.GroupID = itemUpd.GroupID;
|
||||
item.GroupOwned = itemUpd.GroupOwned;
|
||||
item.CreationDate = itemUpd.CreationDate;
|
||||
|
@ -446,6 +485,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.SaleType = itemUpd.SaleType;
|
||||
|
||||
InventoryService.UpdateItem(item);
|
||||
remoteClient.SendBulkUpdateInventory(item);
|
||||
}
|
||||
|
||||
if (UUID.Zero != transactionID)
|
||||
|
|
|
@ -3468,7 +3468,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void AdjustChildPrimPermissions()
|
||||
{
|
||||
uint newOwnerMask = (uint)PermissionMask.All & 0xfffffff8; // Mask folded bits
|
||||
uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
|
||||
uint foldedPerms = RootPart.OwnerMask & 3;
|
||||
|
||||
ForEachPart(part =>
|
||||
|
|
|
@ -470,8 +470,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private uint _category;
|
||||
private Int32 _creationDate;
|
||||
private uint _parentID = 0;
|
||||
private uint _baseMask = (uint)PermissionMask.All;
|
||||
private uint _ownerMask = (uint)PermissionMask.All;
|
||||
private uint _baseMask = (uint)(PermissionMask.All | PermissionMask.Export);
|
||||
private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export);
|
||||
private uint _groupMask = (uint)PermissionMask.None;
|
||||
private uint _everyoneMask = (uint)PermissionMask.None;
|
||||
private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
|
@ -4319,10 +4319,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void TrimPermissions()
|
||||
{
|
||||
BaseMask &= (uint)PermissionMask.All;
|
||||
OwnerMask &= (uint)PermissionMask.All;
|
||||
BaseMask &= (uint)(PermissionMask.All | PermissionMask.Export);
|
||||
OwnerMask &= (uint)(PermissionMask.All | PermissionMask.Export);
|
||||
GroupMask &= (uint)PermissionMask.All;
|
||||
EveryoneMask &= (uint)PermissionMask.All;
|
||||
EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export);
|
||||
NextOwnerMask &= (uint)PermissionMask.All;
|
||||
}
|
||||
|
||||
|
@ -4425,10 +4425,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
baseMask;
|
||||
break;
|
||||
case 8:
|
||||
// Trying to set export permissions - extra checks
|
||||
if (set && (mask & (uint)PermissionMask.Export) != 0)
|
||||
{
|
||||
if ((OwnerMask & (uint)PermissionMask.Export) == 0 || (BaseMask & (uint)PermissionMask.Export) == 0 || (NextOwnerMask & (uint)PermissionMask.All) != (uint)PermissionMask.All)
|
||||
mask &= ~(uint)PermissionMask.Export;
|
||||
}
|
||||
EveryoneMask = ApplyMask(EveryoneMask, set, mask) &
|
||||
baseMask;
|
||||
break;
|
||||
case 16:
|
||||
// Force full perm if export
|
||||
if ((EveryoneMask & (uint)PermissionMask.Export) != 0)
|
||||
{
|
||||
NextOwnerMask = (uint)PermissionMask.All;
|
||||
break;
|
||||
}
|
||||
NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) &
|
||||
baseMask;
|
||||
// Prevent the client from creating no copy, no transfer
|
||||
|
@ -5225,9 +5237,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void ApplyNextOwnerPermissions()
|
||||
{
|
||||
BaseMask &= NextOwnerMask;
|
||||
// Export needs to be preserved in the base and everyone
|
||||
// mask, but removed in the owner mask as a next owner
|
||||
// can never change the export status
|
||||
BaseMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
||||
OwnerMask &= NextOwnerMask;
|
||||
EveryoneMask &= NextOwnerMask;
|
||||
EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
|
||||
|
||||
Inventory.ApplyNextOwnerPermissions();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue