mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Tests for RM-6780 Add "Declare and File Record" Share action
This commit is contained in:
@@ -27,9 +27,11 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.record;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.jlan.client.info.FileInfo;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||
@@ -212,7 +214,68 @@ public class CreateRecordTest extends BaseRMTestCase
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* unit test for RM1649 fix
|
||||
* test if a user with create record permissions and without file record permission is able to create a record
|
||||
* within unfiled record container
|
||||
*/
|
||||
public void testCreateRecordCapabilityInUnfiledRecordFolder() throws Exception
|
||||
{
|
||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||
{
|
||||
/** test data */
|
||||
String roleName = GUID.generate();
|
||||
String user = GUID.generate();
|
||||
NodeRef unfiledRecordFolder;
|
||||
|
||||
public void given()
|
||||
{
|
||||
// create a role with view and create capabilities
|
||||
Set<Capability> capabilities = new HashSet<Capability>(2);
|
||||
capabilities.add(capabilityService.getCapability("ViewRecords"));
|
||||
capabilities.add(capabilityService.getCapability("CreateRecords"));
|
||||
filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities);
|
||||
|
||||
|
||||
// create user and assign to role
|
||||
createPerson(user, true);
|
||||
filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user);
|
||||
|
||||
//give read and file permission to user on unfiled records container
|
||||
filePlanPermissionService.setPermission(unfiledContainer, user, RMPermissionModel.FILING);
|
||||
// create unfiled folder
|
||||
unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my " +
|
||||
"test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void when()
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
recordService.createRecord(filePlan, dmDocument, unfiledRecordFolder, true);
|
||||
// record = recordService.createRecordFromContent(unfiledContainer, GUID.generate(),
|
||||
// TYPE_CONTENT, null, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, user);
|
||||
}
|
||||
|
||||
public void then()
|
||||
{
|
||||
|
||||
// check the details of the record
|
||||
assertTrue(recordService.isRecord(dmDocument));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Given I have ViewRecord and CreateRecord capabilities
|
||||
* And I have filling on a record folder
|
||||
|
Reference in New Issue
Block a user