@DELETE @Path("/system/topologyeditortoolbar/{id}") @Timed public Response removeTopologyEditorToolbar(@PathParam("id") Long userIdToBeDeleted, @Context SecurityContext securityContext) { SecurityUtil.checkPermissions(authorizer, securityContext, TopologyEditorToolbar.NAMESPACE, userIdToBeDeleted, Permission.DELETE); return catalogService.removeTopologyEditorToolbar(userIdToBeDeleted) .map(toolbar -> { SecurityUtil.removeAcl(authorizer, securityContext, TopologyEditorToolbar.NAMESPACE, userIdToBeDeleted); return WSUtils.respondEntity(toolbar, OK); }) .orElseThrow(() -> EntityNotFoundException.byId(String.valueOf(userIdToBeDeleted))); }
@DELETE @Path("/system/topologyeditortoolbar") @Timed public Response removeTopologyEditorToolbar(@Context SecurityContext securityContext) { long userId = getUserId(securityContext); SecurityUtil.checkPermissions(authorizer, securityContext, TopologyEditorToolbar.NAMESPACE, userId, Permission.DELETE); return catalogService.removeTopologyEditorToolbar(userId) .map(toolbar -> { SecurityUtil.removeAcl(authorizer, securityContext, TopologyEditorToolbar.NAMESPACE, userId); return WSUtils.respondEntity(toolbar, OK); }) .orElseThrow(() -> EntityNotFoundException.byId(String.valueOf(userId))); }
@DELETE @Path("/notifiers/{id}") @Timed public Response removeNotifierInfo(@PathParam("id") Long id, @Context SecurityContext securityContext) { SecurityUtil.checkPermissions(authorizer, securityContext, Notifier.NAMESPACE, id, DELETE); Notifier removedNotifier = catalogService.removeNotifierInfo(id); if (removedNotifier != null) { SecurityUtil.removeAcl(authorizer, securityContext, Notifier.NAMESPACE, id); return WSUtils.respondEntity(removedNotifier, OK); } throw EntityNotFoundException.byId(id.toString()); }
@DELETE @Path("/namespaces/{id}") @Timed public Response removeNamespace(@PathParam("id") Long namespaceId, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_ENVIRONMENT_SUPER_ADMIN, Namespace.NAMESPACE, namespaceId, DELETE); assertNoTopologyRefersNamespace(namespaceId); Namespace removed = environmentService.removeNamespace(namespaceId); if (removed != null) { SecurityUtil.removeAcl(authorizer, securityContext, Namespace.NAMESPACE, namespaceId); return WSUtils.respondEntity(removed, OK); } throw EntityNotFoundException.byId(namespaceId.toString()); }
/** * Deletes the file of given {@code fileId} * * @param fileId */ @DELETE @Path("/files/{id}") @Timed public Response removeFile(@PathParam("id") Long fileId, @Context SecurityContext securityContext) throws IOException { SecurityUtil.checkPermissions(authorizer, securityContext, File.NAMESPACE, fileId, DELETE); try { File removedFile = catalogService.removeFile(fileId); SecurityUtil.removeAcl(authorizer, securityContext, File.NAMESPACE, fileId); log.info("Removed File entry is [{}]", removedFile); if (removedFile != null) { boolean removed = catalogService.deleteFileFromStorage(removedFile.getStoredFileName()); logDeletionMessage(removedFile.getStoredFileName(), removed); return WSUtils.respondEntity(removedFile, OK); } } catch (IOException ex) { log.error("Encountered error in removing file with id [{}]", fileId, ex); throw ex; } log.info("File entry with id [{}] is not found", fileId); throw EntityNotFoundException.byId(fileId.toString()); }
UDF removedUDF = catalogService.removeUDF(id); if (removedUDF != null) { SecurityUtil.removeAcl(authorizer, securityContext, UDF.NAMESPACE, id); return WSUtils.respondEntity(removedUDF, OK);
response = removeAllTopologyVersions(topologyId); SecurityUtil.removeAcl(authorizer, securityContext, NAMESPACE, topologyId); return response;
@DELETE @Path("/clusters/{id}") @Timed public Response removeCluster(@PathParam("id") Long clusterId, @Context SecurityContext securityContext) { assertNoNamespaceRefersCluster(clusterId); SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_SERVICE_POOL_SUPER_ADMIN, NAMESPACE, clusterId, DELETE); // remove all services / service configurations / components / component processes in this cluster Collection<Service> services = environmentService.listServices(clusterId); services.forEach(svc -> { environmentService.listServiceConfigurations(svc.getId()) .forEach(sc -> environmentService.removeServiceConfiguration(sc.getId())); Collection<Component> components = environmentService.listComponents(svc.getId()); components.forEach(component -> { environmentService.listComponentProcesses(component.getId()) .forEach(componentProcess -> environmentService.removeComponentProcess(componentProcess.getId())); environmentService.removeComponent(component.getId()); }); environmentService.removeService(svc.getId()); }); Cluster removedCluster = environmentService.removeCluster(clusterId); if (removedCluster != null) { SecurityUtil.removeAcl(authorizer, securityContext, NAMESPACE, clusterId); return WSUtils.respondEntity(removedCluster, OK); } throw EntityNotFoundException.byId(clusterId.toString()); }