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;
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;

@ -38,7 +38,7 @@ import java.util.Map;
public class LifecycleStateManager {
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 {
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();

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

Loading…
Cancel
Save