change CanDeedObject. WARNING like on other grids, if you do not set next owner rights on object and ALL ITS CONTENTS, you may loose all rights on it
parent
b9651652e1
commit
d8108ab740
|
@ -71,12 +71,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
#region Constants
|
||||
// These are here for testing. They will be taken out
|
||||
|
||||
//private uint PERM_ALL = (uint)2147483647;
|
||||
private uint PERM_COPY = (uint)32768;
|
||||
//private uint PERM_MODIFY = (uint)16384;
|
||||
private uint PERM_MOVE = (uint)524288;
|
||||
private uint PERM_TRANS = (uint)8192;
|
||||
// private uint PERM_LOCKED = (uint)540672;
|
||||
private uint PERM_LOCKED = (uint)524288; // same as move
|
||||
|
||||
/// <value>
|
||||
|
@ -867,6 +861,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return PermissionClass.Everyone;
|
||||
}
|
||||
|
||||
// get effective object permissions using user UUID. User rights will be fixed
|
||||
protected uint GetObjectPermissions(UUID currentUser, SceneObjectGroup group, bool denyOnLocked)
|
||||
{
|
||||
if (group == null)
|
||||
|
@ -918,6 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return group.EffectiveEveryOnePerms & lockmask;
|
||||
}
|
||||
|
||||
// get effective object permissions using present presence. So some may depend on requested rights (ie God)
|
||||
protected uint GetObjectPermissions(ScenePresence sp, SceneObjectGroup group, bool denyOnLocked)
|
||||
{
|
||||
if (sp == null || sp.IsDeleted || group == null || group.IsDeleted)
|
||||
|
@ -1178,15 +1174,40 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed, false);
|
||||
}
|
||||
|
||||
private bool CanDeedObject(UUID user, UUID group, Scene scene)
|
||||
private bool CanDeedObject(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
ScenePresence sp = scene.GetScenePresence(user);
|
||||
IClientAPI client = sp.ControllingClient;
|
||||
if(sog == null || sog.IsDeleted || sp == null || sp.IsDeleted || targetGroupID == UUID.Zero)
|
||||
return false;
|
||||
|
||||
if ((client.GetGroupPowers(group) & (ulong)GroupPowers.DeedObject) == 0)
|
||||
// object has group already?
|
||||
if(sog.GroupID != targetGroupID)
|
||||
return false;
|
||||
|
||||
// is effectivelly shared?
|
||||
if(sog.EffectiveGroupPerms == 0)
|
||||
return false;
|
||||
|
||||
if(sp.IsGod)
|
||||
return true;
|
||||
|
||||
// owned by requester?
|
||||
if(sog.OwnerID != sp.UUID)
|
||||
return false;
|
||||
|
||||
// owner can transfer?
|
||||
if((sog.EffectiveOwnerPerms & (uint)PermissionMask.Transfer) == 0)
|
||||
return false;
|
||||
|
||||
// group member ?
|
||||
ulong powers = 0;
|
||||
if(!GroupMemberPowers(targetGroupID, sp, ref powers))
|
||||
return false;
|
||||
|
||||
// has group rights?
|
||||
if ((powers & (ulong)GroupPowers.DeedObject) == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -2717,9 +2717,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (ownerID != UUID.Zero)
|
||||
return;
|
||||
|
||||
if (!Permissions.CanDeedObject(remoteClient.AgentId, groupID))
|
||||
return;
|
||||
}
|
||||
|
||||
List<SceneObjectGroup> groups = new List<SceneObjectGroup>();
|
||||
|
@ -2750,15 +2747,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
child.TriggerScriptChangedEvent(Changed.OWNER);
|
||||
}
|
||||
}
|
||||
else // The object was deeded to the group
|
||||
else // The object deeded to the group
|
||||
{
|
||||
if (!Permissions.IsGod(remoteClient.AgentId) && sog.OwnerID != remoteClient.AgentId)
|
||||
continue;
|
||||
|
||||
if (!Permissions.CanTransferObject(sog.UUID, groupID))
|
||||
continue;
|
||||
|
||||
if (sog.GroupID != groupID)
|
||||
if (!Permissions.CanDeedObject(remoteClient, sog, groupID))
|
||||
continue;
|
||||
|
||||
sog.SetOwnerId(groupID);
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public delegate bool AbandonParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
||||
public delegate bool ReclaimParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
||||
public delegate bool DeedParcelHandler(UUID user, ILandObject parcel, Scene scene);
|
||||
public delegate bool DeedObjectHandler(UUID user, UUID group, Scene scene);
|
||||
public delegate bool DeedObjectHandler(ScenePresence sp, SceneObjectGroup sog, UUID targetGroupID);
|
||||
public delegate bool BuyLandHandler(UUID user, ILandObject parcel, Scene scene);
|
||||
public delegate bool LinkObjectHandler(UUID user, UUID objectID);
|
||||
public delegate bool DelinkObjectHandler(UUID user, UUID objectID);
|
||||
|
@ -934,15 +934,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool CanDeedObject(UUID user, UUID group)
|
||||
public bool CanDeedObject(IClientAPI client, SceneObjectGroup sog, UUID targetGroupID)
|
||||
{
|
||||
DeedObjectHandler handler = OnDeedObject;
|
||||
if (handler != null)
|
||||
{
|
||||
if(sog == null || client == null || client.SceneAgent == null || targetGroupID == UUID.Zero)
|
||||
return false;
|
||||
|
||||
ScenePresence sp = client.SceneAgent as ScenePresence;
|
||||
|
||||
Delegate[] list = handler.GetInvocationList();
|
||||
foreach (DeedObjectHandler h in list)
|
||||
{
|
||||
if (h(user, group, m_scene) == false)
|
||||
if (h(sp, sog, targetGroupID) == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue