From d9c15b62e7757490ddce5442a486aaad9580f593 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Tue, 31 May 2016 23:26:51 +0530 Subject: [PATCH] few changes after testing user management api --- .../mgt/jaxrs/service/api/UserManagementService.java | 2 +- .../mgt/jaxrs/service/impl/UserManagementServiceImpl.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index f3778efcbc..5eb8d54d42 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -406,7 +406,7 @@ public interface UserManagementService { @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", + httpMethod = "PUT", value = "Changing the user password.", notes = "A user is able to change the password to secure their EMM profile via this REST API.", tags = "User Management") diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index 79d51374b3..af2b599109 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -209,9 +209,8 @@ public class UserManagementServiceImpl implements UserManagementService { userWrapper.getEmailAddress()); if (StringUtils.isNotEmpty(userWrapper.getPassword())) { // Decoding Base64 encoded password - byte[] decodedBytes = Base64.decodeBase64(userWrapper.getPassword()); userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(), - new String(decodedBytes, "UTF-8")); + userWrapper.getPassword()); log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed"); } List currentRoles = this.getFilteredRoles(userStoreManager, userWrapper.getUsername()); @@ -248,7 +247,7 @@ public class UserManagementServiceImpl implements UserManagementService { userWrapper.getUsername() + " doesn't exists. Therefore, request made to update user was " + "refused.").build(); } - } catch (UserStoreException | UnsupportedEncodingException e) { + } catch (UserStoreException e) { String msg = "Exception in trying to update user by username: " + userWrapper.getUsername(); log.error(msg, e); throw new UnexpectedServerErrorException( @@ -305,7 +304,7 @@ public class UserManagementServiceImpl implements UserManagementService { } } - @POST + @GET @Path("/{username}/roles") @Override public Response getRolesOfUser(@PathParam("username") String username) {