diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java index 94768901db..62eb289604 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/DatasourceServiceImpl.java @@ -3,6 +3,7 @@ package com.appsmith.server.services; import com.appsmith.external.models.DatasourceConfiguration; import com.appsmith.external.models.DatasourceTestResult; import com.appsmith.external.plugins.PluginExecutor; +import com.appsmith.server.constants.AnalyticsEvents; import com.appsmith.server.constants.FieldName; import com.appsmith.server.domains.Datasource; import com.appsmith.server.domains.Organization; @@ -49,7 +50,7 @@ public class DatasourceServiceImpl extends BaseService analyticsService, SessionUserService sessionUserService, ObjectMapper objectMapper, PluginService pluginService, @@ -210,4 +211,18 @@ public class DatasourceServiceImpl extends BaseService delete(String id) { + Mono datasourceMono = repository.findById(id) + .switchIfEmpty(Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, "datasource", id))); + return datasourceMono + .flatMap(toDelete -> repository.archive(toDelete).thenReturn(toDelete)) + .flatMap(deletedObj -> + analyticsService.sendEvent( + AnalyticsEvents.DELETE + "_" + deletedObj.getClass().getSimpleName().toUpperCase(), + deletedObj + ) + ); + } + } diff --git a/app/server/appsmith-server/src/main/resources/public/appsmith/authz/acl.rego b/app/server/appsmith-server/src/main/resources/public/appsmith/authz/acl.rego index c4626f3074..ac33bf3f45 100644 --- a/app/server/appsmith-server/src/main/resources/public/appsmith/authz/acl.rego +++ b/app/server/appsmith-server/src/main/resources/public/appsmith/authz/acl.rego @@ -85,6 +85,7 @@ authenticated_operations = [ {"method": "GET", "resource": "datasources", "permission": "read:datasources"}, {"method": "POST", "resource": "datasources", "permission": "create:datasources"}, {"method": "PUT", "resource": "datasources", "permission": "update:datasources"}, + {"method": "DELETE", "resource": "datasources", "permission": "delete:datasources"}, {"method": "GET", "resource": "configs", "permission": "read:configs"}, {"method": "POST", "resource": "configs", "permission": "create:configs"}, diff --git a/app/server/appsmith-server/src/main/resources/public/bundle.tar.gz b/app/server/appsmith-server/src/main/resources/public/bundle.tar.gz index eafd2209ec..50c6dca17b 100644 Binary files a/app/server/appsmith-server/src/main/resources/public/bundle.tar.gz and b/app/server/appsmith-server/src/main/resources/public/bundle.tar.gz differ