permissions GenerateClientFlags() also needs group GetEffectivePermissions() for the everyone case. Current naive uncached GetEffectivePermissions() must be improved since its now a lot more used.

melanie
UbitUmarov 2017-01-14 22:19:20 +00:00
parent e28ac282eb
commit 24d12dfba4
1 changed files with 11 additions and 5 deletions

View File

@ -631,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
#region Object Permissions #region Object Permissions
#pragma warning disable 0612 #pragma warning disable 0612
const uint DEFAULT_FLAGS = (uint)~( const uint DEFAULT_FLAGS = (uint)(
PrimFlags.ObjectCopy | // Tells client you can copy the object PrimFlags.ObjectCopy | // Tells client you can copy the object
PrimFlags.ObjectModify | // tells client you can modify the object PrimFlags.ObjectModify | // tells client you can modify the object
PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod) PrimFlags.ObjectMove | // tells client that you can move the object (only, no mod)
@ -701,6 +701,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0; bool unlocked = (task.ParentGroup.RootPart.OwnerMask & (uint)PermissionMask.Move) != 0;
uint effectivePerms;
UUID taskOwnerID = task.OwnerID; UUID taskOwnerID = task.OwnerID;
UUID spID = sp.UUID; UUID spID = sp.UUID;
@ -718,6 +719,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if(task.ParentGroup.IsAttachment) if(task.ParentGroup.IsAttachment)
{ {
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked); returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
effectivePerms = task.ParentGroup.GetEffectivePermissions();
returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero) if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner; returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask; return returnMask;
@ -726,6 +729,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
UUID taskGroupID = task.GroupID; UUID taskGroupID = task.GroupID;
bool groupdOwned = taskOwnerID == taskGroupID; bool groupdOwned = taskOwnerID == taskGroupID;
// if friends with rights then owner // if friends with rights then owner
if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID)) if (!groupdOwned && IsFriendWithPerms(spID, taskOwnerID))
{ {
@ -753,9 +757,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
returnMask |= (uint)PrimFlags.ObjectOwnerModify; returnMask |= (uint)PrimFlags.ObjectOwnerModify;
return returnMask; return returnMask;
} }
else else if(task.GroupMask != 0)
{ {
// group sharing or everyone // group sharing
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked); returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
returnMask |= returnMask |=
(uint)PrimFlags.ObjectGroupOwned | (uint)PrimFlags.ObjectGroupOwned |
@ -763,9 +767,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return returnMask; return returnMask;
} }
} }
else else if(task.GroupMask != 0)
{ {
// group sharing or everyone // group sharing
returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked); returnMask = ApplyObjectModifyMasks(task.GroupMask | task.EveryoneMask, objflags, unlocked);
if (taskOwnerID != UUID.Zero) if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner; returnMask |= (uint)PrimFlags.ObjectAnyOwner;
@ -774,7 +778,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
} }
// fallback is everyone rights // fallback is everyone rights
effectivePerms = task.ParentGroup.GetEffectivePermissions();
returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked); returnMask = ApplyObjectModifyMasks(task.EveryoneMask, objflags, unlocked);
returnMask &= effectivePerms;
if (taskOwnerID != UUID.Zero) if (taskOwnerID != UUID.Zero)
returnMask |= (uint)PrimFlags.ObjectAnyOwner; returnMask |= (uint)PrimFlags.ObjectAnyOwner;
return returnMask; return returnMask;