Merge pull request #284 from ayyoob/rest-api-improvements

few changes after testing user management api
4.x.x
Prabath Abeysekara 9 years ago
commit 12a22d86ef

@ -406,7 +406,7 @@ public interface UserManagementService {
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "PUT",
value = "Changing the user password.", value = "Changing the user password.",
notes = "A user is able to change the password to secure their EMM profile via this REST API.", notes = "A user is able to change the password to secure their EMM profile via this REST API.",
tags = "User Management") tags = "User Management")

@ -209,9 +209,8 @@ public class UserManagementServiceImpl implements UserManagementService {
userWrapper.getEmailAddress()); userWrapper.getEmailAddress());
if (StringUtils.isNotEmpty(userWrapper.getPassword())) { if (StringUtils.isNotEmpty(userWrapper.getPassword())) {
// Decoding Base64 encoded password // Decoding Base64 encoded password
byte[] decodedBytes = Base64.decodeBase64(userWrapper.getPassword());
userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(), userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(),
new String(decodedBytes, "UTF-8")); userWrapper.getPassword());
log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed"); log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed");
} }
List<String> currentRoles = this.getFilteredRoles(userStoreManager, userWrapper.getUsername()); List<String> 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 " + userWrapper.getUsername() + " doesn't exists. Therefore, request made to update user was " +
"refused.").build(); "refused.").build();
} }
} catch (UserStoreException | UnsupportedEncodingException e) { } catch (UserStoreException e) {
String msg = "Exception in trying to update user by username: " + userWrapper.getUsername(); String msg = "Exception in trying to update user by username: " + userWrapper.getUsername();
log.error(msg, e); log.error(msg, e);
throw new UnexpectedServerErrorException( throw new UnexpectedServerErrorException(
@ -305,7 +304,7 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
} }
@POST @GET
@Path("/{username}/roles") @Path("/{username}/roles")
@Override @Override
public Response getRolesOfUser(@PathParam("username") String username) { public Response getRolesOfUser(@PathParam("username") String username) {

Loading…
Cancel
Save