a few changes to objects permissions

master
UbitUmarov 2020-02-26 20:33:29 +00:00
parent c2ca5a699d
commit 8c74e47557
1 changed files with 46 additions and 37 deletions

View File

@ -808,10 +808,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask; return returnMask;
} }
uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
// owner // owner
if (spID == taskOwnerID) if (spID == taskOwnerID)
{ {
returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked); returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
returnMask |= EXTRAOWNERMASK; returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0) if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify; returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@ -819,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
} }
// if not god or owner, do attachments as everyone // if not god or owner, do attachments as everyone
if(task.ParentGroup.IsAttachment) if (task.ParentGroup.IsAttachment)
{ {
returnMask = ApplyObjectModifyMasks(grp.EffectiveEveryOnePerms, objflags, unlocked); returnMask = ApplyObjectModifyMasks(grp.EffectiveEveryOnePerms, objflags, unlocked);
if (taskOwnerID != UUID.Zero) if (taskOwnerID != UUID.Zero)
@ -830,10 +831,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID taskGroupID = task.GroupID; UUID taskGroupID = task.GroupID;
bool notGroupdOwned = taskOwnerID != taskGroupID; bool notGroupdOwned = taskOwnerID != taskGroupID;
if ((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
// if friends with rights then owner // if friends with rights then owner
if (notGroupdOwned && IsFriendWithPerms(spID, taskOwnerID)) if (notGroupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{ {
returnMask = ApplyObjectModifyMasks(grp.EffectiveOwnerPerms, objflags, unlocked); returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
returnMask |= EXTRAOWNERMASK; returnMask |= EXTRAOWNERMASK;
if((returnMask & (uint)PrimFlags.ObjectModify) != 0) if((returnMask & (uint)PrimFlags.ObjectModify) != 0)
returnMask |= (uint)PrimFlags.ObjectOwnerModify; returnMask |= (uint)PrimFlags.ObjectOwnerModify;
@ -865,10 +869,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask; return returnMask;
} }
// we may have copy without transfer
uint grpEffectiveOwnerPerms = grp.EffectiveOwnerPerms;
if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked); returnMask = ApplyObjectModifyMasks(grpEffectiveOwnerPerms, objflags, unlocked);
returnMask |= returnMask |=
(uint)PrimFlags.ObjectGroupOwned | (uint)PrimFlags.ObjectGroupOwned |
@ -972,18 +972,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint lockmask = (uint)PermissionMask.AllEffective; uint lockmask = (uint)PermissionMask.AllEffective;
if(locked) if(locked)
lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move); lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move);
uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask;
if (currentUser == objectOwner) if (currentUser == objectOwner)
return group.EffectiveOwnerPerms & lockmask; return grpEffectiveOwnerPerms & lockmask;
if (group.IsAttachment) if (group.IsAttachment)
return 0; return 0;
if ((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
UUID sogGroupID = group.GroupID; UUID sogGroupID = group.GroupID;
bool notgroudOwned = sogGroupID != objectOwner; bool notgroudOwned = sogGroupID != objectOwner;
if (notgroudOwned && IsFriendWithPerms(currentUser, objectOwner)) if (notgroudOwned && IsFriendWithPerms(currentUser, objectOwner))
return group.EffectiveOwnerPerms & lockmask; return grpEffectiveOwnerPerms & lockmask;
ulong powers = 0; ulong powers = 0;
if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, currentUser, ref powers)) if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, currentUser, ref powers))
@ -994,10 +999,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((powers & (ulong)GroupPowers.ObjectManipulate) == 0) if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
return group.EffectiveGroupOrEveryOnePerms & lockmask; return group.EffectiveGroupOrEveryOnePerms & lockmask;
uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask; return grpEffectiveOwnerPerms & lockmask;
if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
return grpEffectiveOwnerPerms;
} }
return group.EffectiveEveryOnePerms & lockmask; return group.EffectiveEveryOnePerms & lockmask;
@ -1028,18 +1030,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions
uint lockmask = (uint)PermissionMask.AllEffective; uint lockmask = (uint)PermissionMask.AllEffective;
if(locked) if(locked)
lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move); lockmask &= ~(uint)(PermissionMask.Modify | PermissionMask.Move);
uint ownerperms = group.EffectiveOwnerPerms;
if (spID == objectOwner) if (spID == objectOwner)
return group.EffectiveOwnerPerms & lockmask; return ownerperms & lockmask;
if (group.IsAttachment) if (group.IsAttachment)
return 0; return 0;
if ((ownerperms & (uint)PermissionMask.Transfer) == 0)
ownerperms &= ~(uint)PermissionMask.Copy;
UUID sogGroupID = group.GroupID; UUID sogGroupID = group.GroupID;
bool notgroudOwned = sogGroupID != objectOwner; bool notgroudOwned = sogGroupID != objectOwner;
if (notgroudOwned && IsFriendWithPerms(spID, objectOwner)) if (notgroudOwned && IsFriendWithPerms(spID, objectOwner))
return group.EffectiveOwnerPerms & lockmask; {
return ownerperms & lockmask;
}
ulong powers = 0; ulong powers = 0;
if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, sp, ref powers)) if (sogGroupID != UUID.Zero && GroupMemberPowers(sogGroupID, sp, ref powers))
@ -1050,10 +1058,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if((powers & (ulong)GroupPowers.ObjectManipulate) == 0) if((powers & (ulong)GroupPowers.ObjectManipulate) == 0)
return group.EffectiveGroupOrEveryOnePerms & lockmask; return group.EffectiveGroupOrEveryOnePerms & lockmask;
uint grpEffectiveOwnerPerms = group.EffectiveOwnerPerms & lockmask; return ownerperms & lockmask;
if((grpEffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
grpEffectiveOwnerPerms &= ~(uint)PermissionMask.Copy;
return grpEffectiveOwnerPerms;
} }
return group.EffectiveEveryOnePerms & lockmask; return group.EffectiveEveryOnePerms & lockmask;
@ -2054,7 +2059,7 @@ 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); //sp.ControllingClient.SendAgentAlertMessage("Copying this item has been denied by the permissions system", false);
return false; return false;
} }
@ -2364,43 +2369,47 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false; return false;
if (m_bypassPermissions) if (m_bypassPermissions)
return m_bypassPermissionsValue; return true;
SceneObjectGroup srcsog = sourcePart.ParentGroup; SceneObjectGroup srcsog = sourcePart.ParentGroup;
SceneObjectGroup destsog = destPart.ParentGroup; SceneObjectGroup destsog = destPart.ParentGroup;
if (srcsog == null || destsog == null) if (srcsog == null || destsog == null)
return false; return false;
uint destsogEffectiveOwnerPerms = destsog.EffectiveOwnerPerms;
// dest is locked // dest is locked
if((destsog.EffectiveOwnerPerms & (uint)PermissionMask.Move) == 0) if ((destsogEffectiveOwnerPerms & (uint)PermissionMask.Move) == 0)
return false; return false;
uint itperms = item.CurrentPermissions; uint itperms = item.CurrentPermissions;
uint srcsogEffectiveOwnerPerms = srcsog.EffectiveOwnerPerms;
// if item is no copy the source is modifed // if item is no copy the source is modifed
if((itperms & (uint)PermissionMask.Copy) == 0 && (srcsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0) if ((itperms & (uint)PermissionMask.Copy) == 0)
return false; {
if(srcsog.IsAttachment || destsog.IsAttachment)
return false;
if((srcsogEffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
return false;
}
UUID srcOwner = srcsog.OwnerID; bool notSameOwner = srcsog.OwnerID != destsog.OwnerID;
UUID destOwner = destsog.OwnerID;
bool notSameOwner = srcOwner != destOwner;
if(notSameOwner) if(notSameOwner)
{ {
if((itperms & (uint)PermissionMask.Transfer) == 0) if((itperms & (uint)PermissionMask.Transfer) == 0)
return false; return false;
// scripts can't be droped if(destsog.IsAttachment && (destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
if(item.InvType == (int)InventoryType.LSL)
return false; return false;
if((destsogEffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
return false; return false;
} }
else else
{ {
if((destsog.RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0 && if((destsogEffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
(destsog.EffectiveOwnerPerms & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -2419,7 +2428,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return false; return false;
if (m_bypassPermissions) if (m_bypassPermissions)
return m_bypassPermissionsValue; return true;
if(sp.IsGod) if(sp.IsGod)
return true; return true;