RM-1463 (Item the user has read only permissions for can be added to hold in from Records Search results)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@72191 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-05-28 20:26:11 +00:00
parent 81a71c041e
commit 5df1052bb9

View File

@@ -20,6 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.test.service;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -37,6 +39,12 @@ public class HoldServiceImplTest extends BaseRMTestCase
return true;
}
@Override
protected boolean isUserTest()
{
return true;
}
public void testDeleteHoldBehaviourForRecordFolder()
{
doTestInTransaction(new Test<Void>()
@@ -139,4 +147,38 @@ public class HoldServiceImplTest extends BaseRMTestCase
});
}
public void testAddRecordFolderOrRecordToHoldWithoutFilingPermission()
{
// Create hold
final NodeRef hold = holdService.createHold(filePlan, "hold one", "I have my reasons", "but I'll not describe them here!");
assertNotNull(hold);
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 only read permissions on the record folder
permissionService.setPermission(rmFolder, userName, RMPermissionModel.READ_RECORDS, true);
return null;
}
}, "admin");
doTestInTransaction(new FailureTest(AlfrescoRuntimeException.class)
{
@Override
public void run() throws Exception
{
holdService.addToHold(hold, rmFolder);
}
}, userName);
}
}