revert-70ac1926
Charitha Goonetilleke 4 years ago
commit 0abde116ca

@ -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();

@ -17,14 +17,9 @@
"acorn": "^6.2.0", "acorn": "^6.2.0",
"antd": "^4.0.0", "antd": "^4.0.0",
"axios": "^0.19.0", "axios": "^0.19.0",
"babel-eslint": "^9.0.0",
"d3": "^5.9.7", "d3": "^5.9.7",
"dagre": "^0.8.4", "dagre": "^0.8.4",
"entgra-icons-react": "^1.0.0", "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", "fetch": "^1.1.0",
"imagemin": "^6.1.0", "imagemin": "^6.1.0",
"keymirror": "^0.1.1", "keymirror": "^0.1.1",
@ -64,7 +59,9 @@
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-config-prettier": "4.3.0", "eslint-config-prettier": "4.3.0",
"eslint-plugin-babel": "5.3.0", "eslint-plugin-babel": "5.3.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jsx": "0.0.2", "eslint-plugin-jsx": "0.0.2",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "3.1.0", "eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.14.2", "eslint-plugin-react": "7.14.2",
"express": "^4.17.1", "express": "^4.17.1",

@ -83,6 +83,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
.validatePolicyDetails(policyWrapper); .validatePolicyDetails(policyWrapper);
// validation failure results; // validation failure results;
if (!features.isEmpty()) { 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.BAD_REQUEST).entity(features).build();
} }
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService(); PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
@ -223,6 +224,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
.validatePolicyDetails(policyWrapper); .validatePolicyDetails(policyWrapper);
// validation failure results; // validation failure results;
if (!features.isEmpty()) { 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.BAD_REQUEST).entity(features).build();
} }
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService(); PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
@ -480,6 +482,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
= RequestValidationUtil.validateProfileFeatures(profileFeaturesList); = RequestValidationUtil.validateProfileFeatures(profileFeaturesList);
// validation failure results; // validation failure results;
if (!features.isEmpty()) { 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.BAD_REQUEST).entity(features).build();
} }
return Response.status(Response.Status.OK).entity("Valid request").build(); return Response.status(Response.Status.OK).entity("Valid request").build();

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