From ef8af6b4546a6c94aba034eb4711a90d4dda7974 Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Thu, 27 Aug 2020 05:29:24 +0530 Subject: [PATCH 1/3] Fix APPM custom permission loading issue --- .../mgt/core/impl/AppmDataHandlerImpl.java | 3 --- .../core/lifecycle/LifecycleStateManager.java | 5 +++-- .../src/main/resources/conf/application-mgt.xml | 16 ++++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/AppmDataHandlerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/AppmDataHandlerImpl.java index 46763dae2d..40c3de260c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/AppmDataHandlerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/AppmDataHandlerImpl.java @@ -17,21 +17,18 @@ package org.wso2.carbon.device.application.mgt.core.impl; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.config.LifecycleState; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.RequestValidatingException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationReleaseDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import org.wso2.carbon.device.application.mgt.core.exception.BadRequestException; import org.wso2.carbon.device.application.mgt.core.util.APIUtil; -import org.wso2.carbon.device.application.mgt.core.util.DAOUtil; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; import org.wso2.carbon.device.application.mgt.core.internal.DataHolder; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManager.java index 612c055867..e0f9a2f796 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManager.java @@ -38,7 +38,7 @@ import java.util.Map; public class LifecycleStateManager { private Map lifecycleStates; - private static Log log = LogFactory.getLog(LifecycleStateManager.class); + private static final Log log = LogFactory.getLog(LifecycleStateManager.class); public void init(List states) throws LifecycleManagementException { lifecycleStates = new HashMap<>(); @@ -48,7 +48,8 @@ public class LifecycleStateManager { } lifecycleStates.put(lifecycleState.getName().toUpperCase(), lifecycleState); try { - PermissionUtils.putPermission(lifecycleState.getPermission()); + PermissionUtils + .putPermission(PermissionUtils.ADMIN_PERMISSION_REGISTRY_PATH + lifecycleState.getPermission()); } catch (PermissionManagementException e) { String msg = "Error when adding permission " + lifecycleState.getPermission() + " related to the " + "state: " + lifecycleState.getName(); diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml index aa48301903..d0d02a058a 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -77,13 +77,13 @@ true true true - /permission/admin/app-mgt/life-cycle/application/create + /app-mgt/life-cycle/application/create In-Review - /permission/admin/app-mgt/life-cycle/application/review + /app-mgt/life-cycle/application/review Rejected Approved @@ -91,7 +91,7 @@ - /permission/admin/app-mgt/life-cycle/application/approve + /app-mgt/life-cycle/application/approve In-Review Published @@ -99,28 +99,28 @@ true - /permission/admin/app-mgt/life-cycle/application/reject + /app-mgt/life-cycle/application/reject In-Review true - /permission/admin/app-mgt/life-cycle/application/publish + /app-mgt/life-cycle/application/publish Blocked Deprecated - /permission/admin/app-mgt/life-cycle/application/block + /app-mgt/life-cycle/application/block Published Deprecated - /permission/admin/app-mgt/life-cycle/application/deprecate + /app-mgt/life-cycle/application/deprecate Published Retired @@ -128,7 +128,7 @@ true - /permission/admin/app-mgt/life-cycle/application/retire + /app-mgt/life-cycle/application/retire From 7558f82a76bafc041902f8ffa3b985616bce829d Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 27 Aug 2020 16:37:52 +0530 Subject: [PATCH 2/3] Add error log for backend policy validation failure --- .../mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java index a9fc47691e..d58c4ce870 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -83,6 +83,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { .validatePolicyDetails(policyWrapper); // validation failure results; if (!features.isEmpty()) { + log.error("Policy feature/s validation failed."); return Response.status(Response.Status.BAD_REQUEST).entity(features).build(); } PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService(); @@ -223,6 +224,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { .validatePolicyDetails(policyWrapper); // validation failure results; if (!features.isEmpty()) { + log.error("Policy feature/s validation failed."); return Response.status(Response.Status.BAD_REQUEST).entity(features).build(); } PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService(); @@ -480,6 +482,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { = RequestValidationUtil.validateProfileFeatures(profileFeaturesList); // validation failure results; if (!features.isEmpty()) { + log.error("Policy feature/s validation failed."); return Response.status(Response.Status.BAD_REQUEST).entity(features).build(); } return Response.status(Response.Status.OK).entity("Valid request").build(); From d9c12bfca6c618ced9c106e6a6faa3a7d09be113 Mon Sep 17 00:00:00 2001 From: anjula-sack Date: Wed, 24 Jun 2020 21:09:23 +0530 Subject: [PATCH 3/3] Remove duplicated EsLint dependencies from APPM publisher --- .../react-app/package.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index 49eae0fc0d..f929dfc1e9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -17,14 +17,9 @@ "acorn": "^6.2.0", "antd": "^4.0.0", "axios": "^0.19.0", - "babel-eslint": "^9.0.0", "d3": "^5.9.7", "dagre": "^0.8.4", "entgra-icons-react": "^1.0.0", - "eslint": "^5.16.0", - "eslint-plugin-import": "^2.18.2", - "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-react": "^7.16.0", "fetch": "^1.1.0", "imagemin": "^6.1.0", "keymirror": "^0.1.1", @@ -64,7 +59,9 @@ "eslint": "^5.16.0", "eslint-config-prettier": "4.3.0", "eslint-plugin-babel": "5.3.0", + "eslint-plugin-import": "^2.21.2", "eslint-plugin-jsx": "0.0.2", + "eslint-plugin-jsx-a11y": "^6.3.1", "eslint-plugin-prettier": "3.1.0", "eslint-plugin-react": "7.14.2", "express": "^4.17.1",