dilanua 8 years ago
commit fbd51e31c0

@ -134,14 +134,14 @@ public class UserManagementServiceImpl implements UserManagementService {
public Response updateUser(@PathParam("username") String username, UserInfo userInfo) {
try {
UserStoreManager userStoreManager = DeviceMgtAPIUtils.getUserStoreManager();
if (!userStoreManager.isExistingUser(userInfo.getUsername())) {
if (!userStoreManager.isExistingUser(username)) {
if (log.isDebugEnabled()) {
log.debug("User by username: " + userInfo.getUsername() +
" doesn't exists. Therefore, request made to update user was refused.");
log.debug("User by username: " + username +
" doesn't exists. Therefore, request made to update user was refused.");
}
return Response.status(Response.Status.NOT_FOUND).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("User by username: " +
userInfo.getUsername() + " doesn't exist.").build()).build();
username + " doesn't exist.").build()).build();
}
Map<String, String> defaultUserClaims =
@ -149,11 +149,11 @@ public class UserManagementServiceImpl implements UserManagementService {
userInfo.getEmailAddress());
if (StringUtils.isNotEmpty(userInfo.getPassword())) {
// Decoding Base64 encoded password
userStoreManager.updateCredentialByAdmin(userInfo.getUsername(),
userInfo.getPassword());
log.debug("User credential of username: " + userInfo.getUsername() + " has been changed");
userStoreManager.updateCredentialByAdmin(username,
userInfo.getPassword());
log.debug("User credential of username: " + username + " has been changed");
}
List<String> currentRoles = this.getFilteredRoles(userStoreManager, userInfo.getUsername());
List<String> currentRoles = this.getFilteredRoles(userStoreManager, username);
List<String> newRoles = Arrays.asList(userInfo.getRoles());
List<String> rolesToAdd = new ArrayList<>(newRoles);
@ -167,19 +167,19 @@ public class UserManagementServiceImpl implements UserManagementService {
}
}
rolesToDelete.remove(ROLE_EVERYONE);
userStoreManager.updateRoleListOfUser(userInfo.getUsername(),
rolesToDelete.toArray(new String[rolesToDelete.size()]),
rolesToAdd.toArray(new String[rolesToAdd.size()]));
userStoreManager.setUserClaimValues(userInfo.getUsername(), defaultUserClaims, null);
userStoreManager.updateRoleListOfUser(username,
rolesToDelete.toArray(new String[rolesToDelete.size()]),
rolesToAdd.toArray(new String[rolesToAdd.size()]));
userStoreManager.setUserClaimValues(username, defaultUserClaims, null);
// Outputting debug message upon successful addition of user
if (log.isDebugEnabled()) {
log.debug("User by username: " + userInfo.getUsername() + " was successfully updated.");
log.debug("User by username: " + username + " was successfully updated.");
}
BasicUserInfo updatedUserInfo = this.getBasicUserInfo(username);
return Response.ok().entity(updatedUserInfo).build();
} catch (UserStoreException e) {
String msg = "Error occurred while trying to update user '" + userInfo.getUsername() + "'";
String msg = "Error occurred while trying to update user '" + username + "'";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();

@ -1,52 +0,0 @@
package org.wso2.carbon.device.mgt.core.internal;
///**
// * @scr.component name="org.wso2.carbon.certificate.mgt.core.scep" immediate="true"
// * @scr.reference name="app.mgt.service"
// * interface="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService"
// * cardinality="1..1"
// * policy="dynamic"
// * bind="setApplicationManagementProviderService"
// * unbind="unsetApplicationManagementProviderService"
// */
//public class SCEPManagerServiceComponent {
//
// private static final Log log = LogFactory.getLog(SCEPManagerServiceComponent.class);
//
// protected void activate(ComponentContext componentContext) {
//
// try {
// if (log.isDebugEnabled()) {
// log.debug("Initializing SCEP core bundle");
// }
//
// BundleContext bundleContext = componentContext.getBundleContext();
// bundleContext.registerService(SCEPManager.class.getName(),
// new SCEPManagerImpl(), null);
//
// if (log.isDebugEnabled()) {
// log.debug("SCEP core bundle has been successfully initialized");
// }
// } catch (Throwable e) {
// String msg = "Error occurred while initializing SCEP core bundle";
// log.error(msg, e);
// }
// }
//
// protected void deactivate(ComponentContext ctx) {
// if (log.isDebugEnabled()) {
// log.debug("Deactivating SCEP core bundle");
// }
// }
//
// protected void unsetApplicationManagementProviderService(ApplicationManagementProviderService
// applicationManagementProviderService) {
// //do nothing
// }
//
// protected void setApplicationManagementProviderService(ApplicationManagementProviderService
// applicationManagementProviderService) {
// //do nothing
// }
//
//}
Loading…
Cancel
Save