* This updates adds locking capability. Thanks, lbsa71 for pointing out my bitmasking error of the objectflags! It's still a little bit wonky when you check the checkbox, however it 'takes' and doesn't break anything.

ThreadPoolClientBranch
Teravus Ovares 2008-02-10 21:27:32 +00:00
parent 0756e01475
commit 38f0615ffe
4 changed files with 49 additions and 66 deletions

View File

@ -42,6 +42,7 @@ namespace OpenSim.Region.Environment
private uint PERM_MODIFY = (uint) 16384; private uint PERM_MODIFY = (uint) 16384;
private uint PERM_MOVE = (uint) 524288; private uint PERM_MOVE = (uint) 524288;
private uint PERM_TRANS = (uint) 8192; private uint PERM_TRANS = (uint) 8192;
private uint PERM_LOCKED = (uint) 540672;
// Bypasses the permissions engine (always returns OK) // Bypasses the permissions engine (always returns OK)
// disable in any production environment // disable in any production environment
// TODO: Change this to false when permissions are a desired default // TODO: Change this to false when permissions are a desired default
@ -201,28 +202,25 @@ namespace OpenSim.Region.Environment
// Remove any of the objectFlags that are temporary. These will get added back if appropriate // Remove any of the objectFlags that are temporary. These will get added back if appropriate
// in the next bit of code // in the next bit of code
objflags &= (uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object objflags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object
objflags &= (uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object objflags &= ~(uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object
objflags &= (uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod) objflags &= ~(uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod)
objflags &= (uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it objflags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it
objflags &= (uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object
objflags &= (uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
// Creating the three ObjectFlags options for this method to choose from. // Creating the three ObjectFlags options for this method to choose from.
bool tasklocked = task.GetLocked(); // more debug needed to apply this, so we're going to set this to false for now // Customize the OwnerMask
tasklocked = false; uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags);
uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags, tasklocked);
objectOwnerMask = AddBackBrokenObjectProperties(task.RootPart, objectOwnerMask);
objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner; objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags, tasklocked); // Customize the GroupMask
objectGroupMask = AddBackBrokenObjectProperties(task.RootPart,objectGroupMask); uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags);
// Customize the EveryoneMask
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags);
uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags, tasklocked);
objectEveryoneMask = AddBackBrokenObjectProperties(task.RootPart,objectEveryoneMask);
// Hack to allow collaboration until Groups and Group Permissions are implemented // Hack to allow collaboration until Groups and Group Permissions are implemented
if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0) if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
@ -259,43 +257,13 @@ namespace OpenSim.Region.Environment
return objectEveryoneMask; return objectEveryoneMask;
} }
private uint AddBackBrokenObjectProperties(SceneObjectPart task, uint objectmask)
{
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0)
objectmask |= (uint)LLObject.ObjectFlags.Physics;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0)
objectmask |= (uint)LLObject.ObjectFlags.Scripted;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.TemporaryOnRez) != 0)
objectmask |= (uint)LLObject.ObjectFlags.TemporaryOnRez;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0)
objectmask |= (uint)LLObject.ObjectFlags.Phantom;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Touch) != 0)
objectmask |= (uint)LLObject.ObjectFlags.Touch;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0)
objectmask |= (uint)LLObject.ObjectFlags.Scripted;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.AllowInventoryDrop) != 0)
objectmask |= (uint)LLObject.ObjectFlags.AllowInventoryDrop;
if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.CastShadows) != 0)
objectmask |= (uint)LLObject.ObjectFlags.CastShadows;
return objectmask; private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
}
private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool locked)
{ {
// We are adding the temporary objectflags to the object's objectflags based on the // We are adding the temporary objectflags to the object's objectflags based on the
// permission flag given. These change the F flags on the client. // permission flag given. These change the F flags on the client.
if (!locked)
{
if ((setPermissionMask & (uint)PermissionMask.Copy) != 0) if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
{ {
@ -316,7 +284,7 @@ namespace OpenSim.Region.Environment
{ {
objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer; objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
} }
}
return objectFlagsMask; return objectFlagsMask;
} }
@ -324,6 +292,7 @@ namespace OpenSim.Region.Environment
{ {
// Default: deny // Default: deny
bool permission = false; bool permission = false;
bool locked = false;
if (!m_scene.Entities.ContainsKey(objId)) if (!m_scene.Entities.ContainsKey(objId))
{ {
@ -340,6 +309,19 @@ namespace OpenSim.Region.Environment
SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID objectOwner = group.OwnerID; LLUUID objectOwner = group.OwnerID;
locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
// People shouldn't be able to do anything with locked objects, except the Administrator
// The 'set permissions' runs through a different permission check, so when an object owner
// sets an object locked, the only thing that they can do is unlock it.
//
// Nobody but the object owner can set permissions on an object
//
if (locked && (!IsAdministrator(currentUser)))
{
return false;
}
// Object owners should be able to edit their own content // Object owners should be able to edit their own content
if (currentUser == objectOwner) if (currentUser == objectOwner)
@ -419,8 +401,15 @@ namespace OpenSim.Region.Environment
// Added this because at this point in time it wouldn't be wise for // Added this because at this point in time it wouldn't be wise for
// the administrator object permissions to take effect. // the administrator object permissions to take effect.
LLUUID objectOwner = task.OwnerID; LLUUID objectOwner = task.OwnerID;
// Anyone can move
if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0) if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
permission = true; permission = true;
// Locked
if ((task.RootPart.OwnerMask & PERM_LOCKED) != 0)
permission = false;
} }
return permission; return permission;
} }

View File

@ -768,6 +768,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
group.GrabMovement(offset, pos, remoteClient); group.GrabMovement(offset, pos, remoteClient);
} }
group.SendGroupTerseUpdate();
} }
} }

View File

@ -60,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
/// since the group's last persistent backup /// since the group's last persistent backup
/// </summary> /// </summary>
public bool HasGroupChanged = false; public bool HasGroupChanged = false;
private bool m_locked = false;
private LLVector3 lastPhysGroupPos; private LLVector3 lastPhysGroupPos;
private LLQuaternion lastPhysGroupRot; private LLQuaternion lastPhysGroupRot;
@ -1225,15 +1225,7 @@ namespace OpenSim.Region.Environment.Scenes
Children.Values.CopyTo(partArray, 0); Children.Values.CopyTo(partArray, 0);
return partArray; return partArray;
} }
public bool GetLocked()
{
return m_locked;
}
public void SetLocked(bool val)
{
m_locked = val;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -1620,13 +1620,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (addRemTF == (byte)0) if (addRemTF == (byte)0)
{ {
m_parentGroup.SetLocked(true); //m_parentGroup.SetLocked(true);
//OwnerMask &= ~mask; //PermissionMask.
OwnerMask &= ~mask;
} }
else else
{ {
m_parentGroup.SetLocked(false); //m_parentGroup.SetLocked(false);
//OwnerMask |= mask; OwnerMask |= mask;
} }
SendFullUpdateToAllClients(); SendFullUpdateToAllClients();