From d81733a4d6e3c1351044205a5428b96b04f3a817 Mon Sep 17 00:00:00 2001 From: harshanl Date: Tue, 16 Aug 2016 18:01:49 +0530 Subject: [PATCH 1/2] Removed unused class --- .../internal/SCEPManagerServiceComponent.java | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java deleted file mode 100644 index e5d9058bdf..0000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/SCEPManagerServiceComponent.java +++ /dev/null @@ -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 -// } -// -//} From 2cb8f0b3139881b0c60a01373b13569affafde7c Mon Sep 17 00:00:00 2001 From: harshanl Date: Tue, 16 Aug 2016 18:02:30 +0530 Subject: [PATCH 2/2] Fixed EMM-1392 --- .../impl/UserManagementServiceImpl.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) 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 eda434e2f8..9734c9622d 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 @@ -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 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 currentRoles = this.getFilteredRoles(userStoreManager, userInfo.getUsername()); + List currentRoles = this.getFilteredRoles(userStoreManager, username); List newRoles = Arrays.asList(userInfo.getRoles()); List 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();