If a transfer request is received for a task inventory item asset, then route the permissions request through the existing CanEditScript() and CanEditNotecard() methods.

This implements the 'share with group' flag for notecards and scripts in prim inventory since the PermissionsModule checks group membership and permissions.
Other than that, the code in PermissionsModule duplicates the checks in LLClientView so there should be no change other than allowing group members to edit embedded notecards and scripts.
For all other asset types, the permission checking code in LLClientView continues to be used, pending refactoring of suitable permissions code
This means that 'share with group' will not yet work for prim inventory items other than notecards and scripts
slimupdates
Justin Clark-Casey (justincc) 2010-04-19 21:02:36 +01:00
parent 855eda844f
commit da83ee28be
2 changed files with 75 additions and 50 deletions

View File

@ -7093,7 +7093,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID requestID = new UUID(transfer.TransferInfo.Params, 80); UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat( // m_log.DebugFormat(
// "[LLCLIENTVIEW]: Got request for asset {0} from item {1} in prim {2} by {3}", // "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name); // requestID, itemID, taskID, Name);
if (!(((Scene)m_scene).Permissions.BypassPermissions())) if (!(((Scene)m_scene).Permissions.BypassPermissions()))
@ -7105,15 +7105,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (part == null) if (part == null)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
if (tii == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
return true;
}
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
return true;
}
else if (tii.Type == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
return true;
}
else
{
// TODO: Change this code to allow items other than notecards and scripts to be successfully
// shared with group. In fact, all this permissions checking should move to an IPermissionsModule
if (part.OwnerID != AgentId) if (part.OwnerID != AgentId)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
Name, requestID, itemID, taskID, part.OwnerID); Name, requestID, itemID, taskID, part.OwnerID);
return true; return true;
} }
@ -7121,46 +7144,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID); if (tii.OwnerID != AgentId)
if (ti == null)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID, tii.OwnerID);
return true;
}
if (ti.OwnerID != AgentId)
{
m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, ti.OwnerID);
return true; return true;
} }
if (( if ((
ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID); Name, requestID, itemID, taskID);
return true; return true;
} }
if (ti.AssetID != requestID) if (tii.AssetID != requestID)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[LLCLIENTVIEW]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
Name, requestID, itemID, taskID, ti.AssetID); Name, requestID, itemID, taskID, tii.AssetID);
return true; return true;
} }
} }
}
else // Agent else // Agent
{ {
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
@ -7197,10 +7212,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (assetRequestItem.AssetID != requestID) if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return true; return true;
} }
} }
} }
}
//m_assetCache.AddAssetRequest(this, transfer); //m_assetCache.AddAssetRequest(this, transfer);
@ -11432,7 +11452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// } // }
} }
// m_log.DebugFormat("[LLCLIENTVIEW]: {0} requesting asset {1}", Name, requestID); // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
} }

View File

@ -1079,7 +1079,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1600,7 +1602,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1855,7 +1859,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericObjectPermission(agentID, prim, false); return GenericObjectPermission(agentID, prim, false);
} }
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) { switch (scriptType) {
case 0: case 0: