import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.mso.MsoResponseWrapper2;
import org.onap.vid.properties.Features;
+import org.onap.vid.roles.AllPermissionProperties;
import org.onap.vid.roles.RoleProvider;
+import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
import org.onap.vid.services.AuditService;
import org.onap.vid.utils.SystemPropertiesWrapper;
this.auditService = auditService;
}
- /**
- * Gets the new services status.
- * @param request the request
- * @return the services list
- */
@RequestMapping(method = RequestMethod.GET)
- public List<ServiceInfo> getServicesInfo(HttpServletRequest request,
- @RequestParam(value = "serviceModelId", required = false) UUID serviceModelId) {
- if (serviceModelId == null) {
- return asyncInstantiationBL.getAllServicesInfo();
- } else {
- return asyncInstantiationRepository.listInstantiatedServicesByServiceModelId(serviceModelId);
- }
+ public List<ServiceInfo> getServicesInfo(HttpServletRequest request) {
+ return asyncInstantiationBL.getAllServicesInfo();
}
+
@RequestMapping(value = "bulk", method = RequestMethod.POST)
public MsoResponseWrapper2<List<String>> createBulkOfServices(@RequestBody ServiceInstantiation request, HttpServletRequest httpServletRequest) {
//Push to DB according the model
}
private void throwExceptionIfAccessDenied(ServiceInstantiation request, HttpServletRequest httpServletRequest, String userId) {
- if (featureManager.isActive(Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION) && !roleProvider.getUserRolesValidator(httpServletRequest).isServicePermitted(request.getGlobalSubscriberId(), request.getSubscriptionServiceType())) {
- throw new AccessDeniedException(String.format("User %s is not allowed to make this request", userId));
+ if (featureManager.isActive(Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION)) {
+ RoleValidator roleValidator = roleProvider.getUserRolesValidator(httpServletRequest);
+ if (!roleValidator.isServicePermitted(new AllPermissionProperties(
+ request.getGlobalSubscriberId(),
+ request.getSubscriptionServiceType(),
+ request.getOwningEntityId()))
+ ) {
+ throw new AccessDeniedException(String.format("User %s is not allowed to make this request", userId));
+ }
}
}
}