Rename method to read slightly better: "assign role to user".

Also add missing exception to some Javadoc.
This commit is contained in:
Tom Page
2017-11-10 09:03:04 +00:00
parent fac5036b29
commit ed4f591fd8
3 changed files with 6 additions and 8 deletions

View File

@@ -105,15 +105,15 @@ public class RMRolesAndActionsAPI extends BaseAPI
{ {
userService.create(adminUser, adminPassword, userName, password, email, firstName, lastName); userService.create(adminUser, adminPassword, userName, password, email, firstName, lastName);
} }
assignUserToRole(adminUser, adminPassword, userName, role); assignRoleToUser(adminUser, adminPassword, userName, role);
} }
/** /**
* assign user to records management role * Assign a records management role to a user.
* *
* @throws AssertionError if the assignation is unsuccessful. * @throws AssertionError if the assignation is unsuccessful.
*/ */
public void assignUserToRole(String adminUser, String adminPassword, String userName, String role) public void assignRoleToUser(String adminUser, String adminPassword, String userName, String role)
{ {
AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
String reqURL = MessageFormat.format( String reqURL = MessageFormat.format(
@@ -138,7 +138,7 @@ public class RMRolesAndActionsAPI extends BaseAPI
} }
client.close(); client.close();
} }
assertEquals("Assigning user " + userName + " to role " + role + " failed.", SC_OK, assertEquals("Assigning role " + role + " to user " + userName + " failed.", SC_OK,
response.getStatusLine().getStatusCode()); response.getStatusLine().getStatusCode());
} }

View File

@@ -69,7 +69,6 @@ public class RulesAPI extends BaseAPI
* @param ruleProperties the rule properties * @param ruleProperties the rule properties
* @return The HTTP Response (or null if the response could not be understood). * @return The HTTP Response (or null if the response could not be understood).
*/ */
public HttpResponse createRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties) public HttpResponse createRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
{ {
try try
@@ -90,7 +89,6 @@ public class RulesAPI extends BaseAPI
* @param ruleProperties the rule properties * @param ruleProperties the rule properties
* @return true if the rule has been updated successfully, false otherwise * @return true if the rule has been updated successfully, false otherwise
*/ */
public JSONObject updateRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties) public JSONObject updateRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
{ {
String ruleId = ruleProperties.getId(); String ruleId = ruleProperties.getId();
@@ -131,7 +129,7 @@ public class RulesAPI extends BaseAPI
* @param username the user performing the request * @param username the user performing the request
* @param password the password * @param password the password
* @param containerNodeRef the container on which the rules have been created * @param containerNodeRef the container on which the rules have been created
* @throws if at least one of the rules could not be deleted. * @throws AssertionError if at least one of the rules could not be deleted.
*/ */
public void deleteAllRulesOnContainer(String username, String password, String containerNodeRef) public void deleteAllRulesOnContainer(String username, String password, String containerNodeRef)
{ {

View File

@@ -593,7 +593,7 @@ public class BaseRMRestTest extends RestTest
String userPermission, String userRole) throws Exception String userPermission, String userRole) throws Exception
{ {
getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission); getRestAPIFactory().getRMUserAPI().addUserPermission(categoryId, user, userPermission);
rmRolesAndActionsAPI.assignUserToRole(getAdminUser().getUsername(), rmRolesAndActionsAPI.assignRoleToUser(getAdminUser().getUsername(),
getAdminUser().getPassword(), user.getUsername(), userRole); getAdminUser().getPassword(), user.getUsername(), userRole);
} }