RM-1429 (The user with read-only permissions on the item can unfreeze it via deleting hold)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@72349 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-05-30 14:13:28 +00:00
parent 9be3e71543
commit 2fd27133e1
2 changed files with 39 additions and 3 deletions

View File

@@ -418,12 +418,11 @@ public class HoldServiceImpl extends ServiceBaseImpl
throw new AlfrescoRuntimeException("Can't delete hold, becuase passed node is not a hold. (hold=" + hold.toString() + ")"); throw new AlfrescoRuntimeException("Can't delete hold, becuase passed node is not a hold. (hold=" + hold.toString() + ")");
} }
/*
List<NodeRef> held = getHeld(hold); List<NodeRef> held = getHeld(hold);
List<String> heldNames = new ArrayList<String>(); List<String> heldNames = new ArrayList<String>();
for (NodeRef nodeRef : held) for (NodeRef nodeRef : held)
{ {
if (permissionService.hasPermission(hold, RMPermissionModel.FILING) == AccessStatus.ALLOWED) if (permissionService.hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.DENIED)
{ {
heldNames.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME)); heldNames.add((String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME));
} }
@@ -435,11 +434,12 @@ public class HoldServiceImpl extends ServiceBaseImpl
for (String name : heldNames) for (String name : heldNames)
{ {
sb.append("\n "); sb.append("\n ");
sb.append("'");
sb.append(name); sb.append(name);
sb.append("'");
} }
throw new AlfrescoRuntimeException("Can't delete hold, because filing permissions for the following items are needed: " + sb.toString()); throw new AlfrescoRuntimeException("Can't delete hold, because filing permissions for the following items are needed: " + sb.toString());
} }
*/
// delete the hold node // delete the hold node
nodeService.deleteNode(hold); nodeService.deleteNode(hold);

View File

@@ -360,4 +360,40 @@ public class HoldServiceImplTest extends BaseRMTestCase
} }
}); });
} }
public void testDeleteHoldWithoutPermissionsOnChildren()
{
// Create the test hold
final NodeRef hold = createAndCheckHold();
doTestInTransaction(new Test<Void>()
{
@Override
public Void run() throws Exception
{
// Add the user to the RM Manager role
filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_NAME_RECORDS_MANAGER, userName);
// Give the user filing permissions on the hold
permissionService.setPermission(hold, userName, RMPermissionModel.FILING, true);
// Give the user read permissions on the record folder
permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true);
// Add record folder to the hold
holdService.addToHold(hold, rmFolder);
return null;
}
});
doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class)
{
@Override
public void run() throws Exception
{
holdService.deleteHold(hold);
}
}, userName);
}
} }