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!
user_profiles
Melanie 2013-03-31 21:59:44 +01:00
parent 9fee431cc8
commit 9b83e53b28
3 changed files with 74 additions and 10 deletions

View File

@ -418,18 +418,57 @@ namespace OpenSim.Region.Framework.Scenes
if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid 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)) if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions)) if (item.EveryOnePermissions != (itemUpd.EveryOnePermissions & item.BasePermissions))
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone; item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteEveryone;
item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
item.GroupID = itemUpd.GroupID; item.GroupID = itemUpd.GroupID;
item.GroupOwned = itemUpd.GroupOwned; item.GroupOwned = itemUpd.GroupOwned;
item.CreationDate = itemUpd.CreationDate; item.CreationDate = itemUpd.CreationDate;
@ -451,6 +490,7 @@ namespace OpenSim.Region.Framework.Scenes
item.SaleType = itemUpd.SaleType; item.SaleType = itemUpd.SaleType;
InventoryService.UpdateItem(item); InventoryService.UpdateItem(item);
remoteClient.SendBulkUpdateInventory(item);
} }
if (UUID.Zero != transactionID) if (UUID.Zero != transactionID)

View File

@ -2671,11 +2671,20 @@ namespace OpenSim.Region.Framework.Scenes
public void AdjustChildPrimPermissions() public void AdjustChildPrimPermissions()
{ {
uint newOwnerMask = (uint)(PermissionMask.All | PermissionMask.Export) & 0xfffffff8; // Mask folded bits
uint foldedPerms = RootPart.OwnerMask & 3;
ForEachPart(part => ForEachPart(part =>
{ {
newOwnerMask &= part.BaseMask;
if (part != RootPart) if (part != RootPart)
part.ClonePermissions(RootPart); part.ClonePermissions(RootPart);
}); });
uint lockMask = ~(uint)PermissionMask.Move;
uint lockBit = RootPart.OwnerMask & (uint)PermissionMask.Move;
RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask);
RootPart.ScheduleFullUpdate();
} }
public void UpdatePermissions(UUID AgentID, byte field, uint localID, public void UpdatePermissions(UUID AgentID, byte field, uint localID,

View File

@ -424,8 +424,8 @@ namespace OpenSim.Region.Framework.Scenes
private uint _category; private uint _category;
private Int32 _creationDate; private Int32 _creationDate;
private uint _parentID = 0; private uint _parentID = 0;
private uint _baseMask = (uint)PermissionMask.All; private uint _baseMask = (uint)(PermissionMask.All | PermissionMask.Export);
private uint _ownerMask = (uint)PermissionMask.All; private uint _ownerMask = (uint)(PermissionMask.All | PermissionMask.Export);
private uint _groupMask = (uint)PermissionMask.None; private uint _groupMask = (uint)PermissionMask.None;
private uint _everyoneMask = (uint)PermissionMask.None; private uint _everyoneMask = (uint)PermissionMask.None;
private uint _nextOwnerMask = (uint)PermissionMask.All; private uint _nextOwnerMask = (uint)PermissionMask.All;
@ -3876,10 +3876,10 @@ namespace OpenSim.Region.Framework.Scenes
public void TrimPermissions() public void TrimPermissions()
{ {
BaseMask &= (uint)PermissionMask.All; BaseMask &= (uint)(PermissionMask.All | PermissionMask.Export);
OwnerMask &= (uint)PermissionMask.All; OwnerMask &= (uint)(PermissionMask.All | PermissionMask.Export);
GroupMask &= (uint)PermissionMask.All; GroupMask &= (uint)PermissionMask.All;
EveryoneMask &= (uint)PermissionMask.All; EveryoneMask &= (uint)(PermissionMask.All | PermissionMask.Export);
NextOwnerMask &= (uint)PermissionMask.All; NextOwnerMask &= (uint)PermissionMask.All;
} }
@ -3982,10 +3982,22 @@ namespace OpenSim.Region.Framework.Scenes
baseMask; baseMask;
break; break;
case 8: 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) & EveryoneMask = ApplyMask(EveryoneMask, set, mask) &
baseMask; baseMask;
break; break;
case 16: case 16:
// Force full perm if export
if ((EveryoneMask & (uint)PermissionMask.Export) != 0)
{
NextOwnerMask = (uint)PermissionMask.All;
break;
}
NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) & NextOwnerMask = ApplyMask(NextOwnerMask, set, mask) &
baseMask; baseMask;
// Prevent the client from creating no mod, no copy // Prevent the client from creating no mod, no copy
@ -4743,9 +4755,12 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyNextOwnerPermissions() 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; OwnerMask &= NextOwnerMask;
EveryoneMask &= NextOwnerMask; EveryoneMask &= NextOwnerMask | (uint)PermissionMask.Export;
Inventory.ApplyNextOwnerPermissions(); Inventory.ApplyNextOwnerPermissions();
} }