diff --git a/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java b/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java index 34d540749a1d..0b2e0ccb5e93 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java +++ b/openmetadata-service/src/main/java/org/openmetadata/csv/EntityCsv.java @@ -69,7 +69,7 @@ import org.openmetadata.schema.type.csv.CsvFile; import org.openmetadata.schema.type.csv.CsvHeader; import org.openmetadata.schema.type.csv.CsvImportResult; -import org.openmetadata.schema.type.customproperties.TableConfig; +import org.openmetadata.schema.type.customProperties.TableConfig; import org.openmetadata.service.Entity; import org.openmetadata.service.TypeRegistry; import org.openmetadata.service.jdbi3.EntityRepository; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java index d1872b3db310..b2b380291ba5 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java @@ -144,7 +144,7 @@ import org.openmetadata.schema.type.api.BulkOperationResult; import org.openmetadata.schema.type.api.BulkResponse; import org.openmetadata.schema.type.csv.CsvImportResult; -import org.openmetadata.schema.type.customproperties.TableConfig; +import org.openmetadata.schema.type.customProperties.TableConfig; import org.openmetadata.schema.utils.EntityInterfaceUtil; import org.openmetadata.service.Entity; import org.openmetadata.service.OpenMetadataApplicationConfig; @@ -1493,15 +1493,15 @@ private String getFormattedDateTimeField( private void validateTableType(JsonNode fieldValue, String propertyConfig, String fieldName) { TableConfig tableConfig = JsonUtils.convertValue(JsonUtils.readTree(propertyConfig), TableConfig.class); - org.openmetadata.schema.type.customproperties.Table tableValue = + org.openmetadata.schema.type.customProperties.Table tableValue = JsonUtils.convertValue( JsonUtils.readTree(String.valueOf(fieldValue)), - org.openmetadata.schema.type.customproperties.Table.class); + org.openmetadata.schema.type.customProperties.Table.class); Set configColumns = tableConfig.getColumns(); try { JsonUtils.validateJsonSchema( - tableValue, org.openmetadata.schema.type.customproperties.Table.class); + tableValue, org.openmetadata.schema.type.customProperties.Table.class); Set fieldColumns = new HashSet<>(); fieldValue.get("columns").forEach(column -> fieldColumns.add(column.asText())); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java index f82772dc36f6..c835589fad57 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TypeRepository.java @@ -42,8 +42,8 @@ import org.openmetadata.schema.type.EntityReference; import org.openmetadata.schema.type.Include; import org.openmetadata.schema.type.Relationship; -import org.openmetadata.schema.type.customproperties.EnumConfig; -import org.openmetadata.schema.type.customproperties.TableConfig; +import org.openmetadata.schema.type.customProperties.EnumConfig; +import org.openmetadata.schema.type.customProperties.TableConfig; import org.openmetadata.service.Entity; import org.openmetadata.service.TypeRegistry; import org.openmetadata.service.exception.CatalogExceptionMessage; diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java index 60b0e55aa3b2..6941d0e86dc0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/databases/TableResource.java @@ -122,6 +122,7 @@ protected List getEntitySpecificOperations() { MetadataOperation.VIEW_DATA_PROFILE, MetadataOperation.VIEW_SAMPLE_DATA, MetadataOperation.VIEW_USAGE, + MetadataOperation.VIEW_PROFILER_GLOBAL_CONFIGURATION, MetadataOperation.EDIT_TESTS, MetadataOperation.EDIT_QUERIES, MetadataOperation.EDIT_DATA_PROFILE, diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java index 743632c80256..c463fac3fb6e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/system/SystemResource.java @@ -34,6 +34,7 @@ import org.openmetadata.schema.settings.SettingsType; import org.openmetadata.schema.system.ValidationResponse; import org.openmetadata.schema.type.Include; +import org.openmetadata.schema.type.MetadataOperation; import org.openmetadata.schema.util.EntitiesCount; import org.openmetadata.schema.util.ServicesCount; import org.openmetadata.sdk.PipelineServiceClientInterface; @@ -46,6 +47,8 @@ import org.openmetadata.service.resources.Collection; import org.openmetadata.service.security.Authorizer; import org.openmetadata.service.security.JwtFilter; +import org.openmetadata.service.security.policyevaluator.OperationContext; +import org.openmetadata.service.security.policyevaluator.ResourceContext; import org.openmetadata.service.util.ResultList; import org.openmetadata.service.util.email.EmailUtil; @@ -145,8 +148,18 @@ public Settings getSettingByName( schema = @Schema(implementation = Settings.class))) }) public Settings getProfilerConfigurationSetting( - @Context UriInfo uriInfo, @Context SecurityContext securityContext) { - authorizer.authorizeAdminOrBot(securityContext); + @Context UriInfo uriInfo, + @Context SecurityContext securityContext, + @Parameter( + description = "Entity type for which to get the global profiler configuration", + schema = @Schema(type = "string")) + @QueryParam("entityType") + @DefaultValue("table") + String entityType) { + ResourceContext resourceContext = new ResourceContext(entityType); + OperationContext operationContext = + new OperationContext(entityType, MetadataOperation.VIEW_PROFILER_GLOBAL_CONFIGURATION); + authorizer.authorize(securityContext, operationContext, resourceContext); return systemRepository.getConfigWithKey(SettingsType.PROFILER_CONFIGURATION.value()); } diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryResourceTest.java index 383aec3d954a..248bc9b51fbc 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/glossary/GlossaryResourceTest.java @@ -89,7 +89,7 @@ import org.openmetadata.schema.type.TagLabel.TagSource; import org.openmetadata.schema.type.TaskStatus; import org.openmetadata.schema.type.csv.CsvImportResult; -import org.openmetadata.schema.type.customproperties.TableConfig; +import org.openmetadata.schema.type.customProperties.TableConfig; import org.openmetadata.service.Entity; import org.openmetadata.service.exception.CatalogExceptionMessage; import org.openmetadata.service.jdbi3.EntityRepository.EntityUpdater; diff --git a/openmetadata-service/src/test/java/org/openmetadata/service/resources/metadata/TypeResourceTest.java b/openmetadata-service/src/test/java/org/openmetadata/service/resources/metadata/TypeResourceTest.java index 591e3ee5e757..1cd3e7d8264a 100644 --- a/openmetadata-service/src/test/java/org/openmetadata/service/resources/metadata/TypeResourceTest.java +++ b/openmetadata-service/src/test/java/org/openmetadata/service/resources/metadata/TypeResourceTest.java @@ -48,8 +48,8 @@ import org.openmetadata.schema.type.ChangeDescription; import org.openmetadata.schema.type.CustomPropertyConfig; import org.openmetadata.schema.type.EntityReference; -import org.openmetadata.schema.type.customproperties.EnumConfig; -import org.openmetadata.schema.type.customproperties.TableConfig; +import org.openmetadata.schema.type.customProperties.EnumConfig; +import org.openmetadata.schema.type.customProperties.TableConfig; import org.openmetadata.service.Entity; import org.openmetadata.service.resources.EntityResourceTest; import org.openmetadata.service.resources.types.TypeResource; diff --git a/openmetadata-spec/src/main/resources/json/schema/entity/policies/accessControl/resourceDescriptor.json b/openmetadata-spec/src/main/resources/json/schema/entity/policies/accessControl/resourceDescriptor.json index 76c7e415c94f..315348886eef 100644 --- a/openmetadata-spec/src/main/resources/json/schema/entity/policies/accessControl/resourceDescriptor.json +++ b/openmetadata-spec/src/main/resources/json/schema/entity/policies/accessControl/resourceDescriptor.json @@ -21,6 +21,7 @@ "ViewTests", "ViewQueries", "ViewDataProfile", + "ViewProfilerGlobalConfiguration", "ViewSampleData", "ViewTestCaseFailedRowsSample", "EditAll", diff --git a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/complexTypes.json b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/complexTypes.json index ff9034ac95ce..6bb1023e16d4 100644 --- a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/complexTypes.json +++ b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/complexTypes.json @@ -104,7 +104,7 @@ "title": "Table", "description": "A table-type custom property having rows and columns where all column data types are strings.", "type": "object", - "javaType": "org.openmetadata.schema.type.customproperties.Table", + "javaType": "org.openmetadata.schema.type.customProperties.Table", "properties": { "columns": { "type": "array", diff --git a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/enumConfig.json b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/enumConfig.json index 459dbac8aab6..e9ffe0df6b9a 100644 --- a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/enumConfig.json +++ b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/enumConfig.json @@ -3,7 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "EnumConfig", "type": "object", - "javaType": "org.openmetadata.schema.type.customproperties.EnumConfig", + "javaType": "org.openmetadata.schema.type.customProperties.EnumConfig", "description": "Applies to Enum type, this config is used to define list of enum values", "properties": { "multiSelect": { diff --git a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/tableConfig.json b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/tableConfig.json index d45cb45a9f9c..55a1bdaf78a7 100644 --- a/openmetadata-spec/src/main/resources/json/schema/type/customProperties/tableConfig.json +++ b/openmetadata-spec/src/main/resources/json/schema/type/customProperties/tableConfig.json @@ -4,7 +4,7 @@ "title": "TableConfig", "description": "Custom property configuration for table-type property where all column data types are strings.", "type": "object", - "javaType": "org.openmetadata.schema.type.customproperties.TableConfig", + "javaType": "org.openmetadata.schema.type.customProperties.TableConfig", "properties": { "columns": { "type": "array",