Merge branch 'master' into 'master'

Fix APPM custom permission loading issue

See merge request entgra/carbon-device-mgt!633
revert-70ac1926
Saad Sahibjan 4 years ago
commit 423f1f5a55

@ -17,21 +17,18 @@
package org.wso2.carbon.device.application.mgt.core.impl; 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.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.common.config.LifecycleState; 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.ApplicationManagementException;
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationStorageManagementException; 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.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.ApplicationStorageManager;
import org.wso2.carbon.device.application.mgt.common.services.AppmDataHandler; 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.ApplicationReleaseDAO;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; 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.exception.BadRequestException;
import org.wso2.carbon.device.application.mgt.core.util.APIUtil; 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.ApplicationManagementDAOException;
import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
import org.wso2.carbon.device.application.mgt.core.internal.DataHolder; import org.wso2.carbon.device.application.mgt.core.internal.DataHolder;

@ -38,7 +38,7 @@ import java.util.Map;
public class LifecycleStateManager { public class LifecycleStateManager {
private Map<String, LifecycleState> lifecycleStates; private Map<String, LifecycleState> lifecycleStates;
private static Log log = LogFactory.getLog(LifecycleStateManager.class); private static final Log log = LogFactory.getLog(LifecycleStateManager.class);
public void init(List<LifecycleState> states) throws LifecycleManagementException { public void init(List<LifecycleState> states) throws LifecycleManagementException {
lifecycleStates = new HashMap<>(); lifecycleStates = new HashMap<>();
@ -48,7 +48,8 @@ public class LifecycleStateManager {
} }
lifecycleStates.put(lifecycleState.getName().toUpperCase(), lifecycleState); lifecycleStates.put(lifecycleState.getName().toUpperCase(), lifecycleState);
try { try {
PermissionUtils.putPermission(lifecycleState.getPermission()); PermissionUtils
.putPermission(PermissionUtils.ADMIN_PERMISSION_REGISTRY_PATH + lifecycleState.getPermission());
} catch (PermissionManagementException e) { } catch (PermissionManagementException e) {
String msg = "Error when adding permission " + lifecycleState.getPermission() + " related to the " String msg = "Error when adding permission " + lifecycleState.getPermission() + " related to the "
+ "state: " + lifecycleState.getName(); + "state: " + lifecycleState.getName();

@ -77,13 +77,13 @@
<IsAppUpdatable>true</IsAppUpdatable> <IsAppUpdatable>true</IsAppUpdatable>
<IsInitialState>true</IsInitialState> <IsInitialState>true</IsInitialState>
<IsDeletableState>true</IsDeletableState> <IsDeletableState>true</IsDeletableState>
<Permission>/permission/admin/app-mgt/life-cycle/application/create</Permission> <Permission>/app-mgt/life-cycle/application/create</Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>In-Review</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="In-Review"> <LifecycleState name="In-Review">
<Permission>/permission/admin/app-mgt/life-cycle/application/review</Permission> <Permission>/app-mgt/life-cycle/application/review</Permission>
<ProceedingStates> <ProceedingStates>
<State>Rejected</State> <State>Rejected</State>
<State>Approved</State> <State>Approved</State>
@ -91,7 +91,7 @@
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Approved"> <LifecycleState name="Approved">
<Permission>/permission/admin/app-mgt/life-cycle/application/approve</Permission> <Permission>/app-mgt/life-cycle/application/approve</Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>In-Review</State>
<State>Published</State> <State>Published</State>
@ -99,28 +99,28 @@
</LifecycleState> </LifecycleState>
<LifecycleState name="Rejected"> <LifecycleState name="Rejected">
<IsDeletableState>true</IsDeletableState> <IsDeletableState>true</IsDeletableState>
<Permission>/permission/admin/app-mgt/life-cycle/application/reject</Permission> <Permission>/app-mgt/life-cycle/application/reject</Permission>
<ProceedingStates> <ProceedingStates>
<State>In-Review</State> <State>In-Review</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Published"> <LifecycleState name="Published">
<IsAppInstallable>true</IsAppInstallable> <IsAppInstallable>true</IsAppInstallable>
<Permission>/permission/admin/app-mgt/life-cycle/application/publish</Permission> <Permission>/app-mgt/life-cycle/application/publish</Permission>
<ProceedingStates> <ProceedingStates>
<State>Blocked</State> <State>Blocked</State>
<State>Deprecated</State> <State>Deprecated</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Blocked"> <LifecycleState name="Blocked">
<Permission>/permission/admin/app-mgt/life-cycle/application/block</Permission> <Permission>/app-mgt/life-cycle/application/block</Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State> <State>Published</State>
<State>Deprecated</State> <State>Deprecated</State>
</ProceedingStates> </ProceedingStates>
</LifecycleState> </LifecycleState>
<LifecycleState name="Deprecated"> <LifecycleState name="Deprecated">
<Permission>/permission/admin/app-mgt/life-cycle/application/deprecate</Permission> <Permission>/app-mgt/life-cycle/application/deprecate</Permission>
<ProceedingStates> <ProceedingStates>
<State>Published</State> <State>Published</State>
<State>Retired</State> <State>Retired</State>
@ -128,7 +128,7 @@
</LifecycleState> </LifecycleState>
<LifecycleState name="Retired"> <LifecycleState name="Retired">
<IsEndState>true</IsEndState> <IsEndState>true</IsEndState>
<Permission>/permission/admin/app-mgt/life-cycle/application/retire</Permission> <Permission>/app-mgt/life-cycle/application/retire</Permission>
</LifecycleState> </LifecycleState>
</LifecycleStates> </LifecycleStates>

Loading…
Cancel
Save