From ef8af6b4546a6c94aba034eb4711a90d4dda7974 Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Thu, 27 Aug 2020 05:29:24 +0530 Subject: [PATCH] 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 46763dae2d7..40c3de260c2 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 612c0558673..e0f9a2f796c 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 aa483019032..d0d02a058a3 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