transform UserPermissions in enum; add helper methods to create users with rm role, permissions or clearance

(cherry picked from commit e8725860eb)

# Conflicts:
#	rm-automation/rm-automation-enterprise-rest-api/src/test/java/org/alfresco/rest/rm/enterprise/v0/classification/content/SetRMExemptionReasonTest.java
This commit is contained in:
cagache
2019-04-23 12:15:38 +03:00
committed by Rodica Sutu
parent ab6a5dbe02
commit 5a30bb57d1
3 changed files with 21 additions and 3 deletions

View File

@@ -57,8 +57,9 @@ public class FilesAPI extends RMModelRequest
* @param fileId The Id of a file to declare as record
* @param parameters Request parameters, refer to API documentation for more details
* @return The {@link Record} for created record
* @throws Exception for malformed JSON responses
*/
public Record declareAsRecord(String fileId, String parameters)
public Record declareAsRecord(String fileId, String parameters) throws Exception
{
mandatoryString("fileId", fileId);
@@ -75,8 +76,9 @@ public class FilesAPI extends RMModelRequest
*
* @param fileId The Id of a file to declare as record
* @return The {@link Record} for created record
* @throws Exception for malformed JSON responses
*/
public Record declareAsRecord(String fileId)
public Record declareAsRecord(String fileId) throws Exception
{
mandatoryString("fileId", fileId);

View File

@@ -616,6 +616,22 @@ public class BaseRMRestTest extends RestTest
recordCategoryAPI.deleteRecordCategory(recordCategoryId);
}
/**
* Assign permission on a record category and give the user RM role
*
* @param user the user to assign rm role and permissions
* @param categoryId the id of the category to assign permissions for
* @param userPermission the permissions to be assigned to the user
* @param userRole the rm role to be assigned to the user
*/
public void assignUserPermissionsOnCategoryAndRMRole(UserModel user, String categoryId, UserPermissions userPermission,
String userRole)
{
getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
rmRolesAndActionsAPI.assignRoleToUser(getAdminUser().getUsername(), getAdminUser().getPassword(),
user.getUsername(), userRole);
}
/**
* Helper method to create a test user with rm role
*

View File

@@ -105,7 +105,7 @@ public class DataProviderClass
* @return file plan component alias
*/
@DataProvider
public static String[][] categoryTypes()
public static Object[][] categoryTypes()
{
return new String[][] {
{ FOLDER_TYPE },