merge-requests/713/head
Charitha Goonetilleke 4 years ago
commit 0abde116ca

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

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

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

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