Minor: lineage settings should be readable by all users (#18529)

This commit is contained in:
Sriharsha Chintalapani 2024-11-06 01:35:32 -08:00 committed by GitHub
parent 5660a751e3
commit f1ebe816b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package org.openmetadata.service.resources.system;
import static org.openmetadata.common.utils.CommonUtil.nullOrEmpty;
import static org.openmetadata.schema.settings.SettingsType.LINEAGE_SETTINGS;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Hidden;
@ -128,7 +129,9 @@ public class SystemResource {
@Parameter(description = "Name of the setting", schema = @Schema(type = "string"))
@PathParam("name")
String name) {
authorizer.authorizeAdmin(securityContext);
if (!name.equalsIgnoreCase(LINEAGE_SETTINGS.toString())) {
authorizer.authorizeAdmin(securityContext);
}
return systemRepository.getConfigWithKey(name);
}

View File

@ -3,6 +3,7 @@ package org.openmetadata.service.resources.system;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.openmetadata.service.util.TestUtils.ADMIN_AUTH_HEADERS;
import static org.openmetadata.service.util.TestUtils.TEST_AUTH_HEADERS;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.dropwizard.configuration.ConfigurationException;
@ -541,7 +542,7 @@ public class SystemResourceTest extends OpenMetadataApplicationTest {
updateSystemConfig(updatedLineageSettings);
// Retrieve the updated settings
Settings updatedSettings = getSystemConfig(SettingsType.LINEAGE_SETTINGS);
Settings updatedSettings = getSystemConfigAsUser(SettingsType.LINEAGE_SETTINGS);
LineageSettings updatedLineageConfig =
JsonUtils.convertValue(updatedSettings.getConfigValue(), LineageSettings.class);
@ -616,6 +617,12 @@ public class SystemResourceTest extends OpenMetadataApplicationTest {
return TestUtils.get(target, Settings.class, ADMIN_AUTH_HEADERS);
}
private static Settings getSystemConfigAsUser(SettingsType settingsType)
throws HttpResponseException {
WebTarget target = getResource(String.format("system/settings/%s", settingsType.value()));
return TestUtils.get(target, Settings.class, TEST_AUTH_HEADERS);
}
private static Settings getProfilerConfig() throws HttpResponseException {
WebTarget target = getResource("system/settings/profilerConfiguration");
return TestUtils.get(target, Settings.class, ADMIN_AUTH_HEADERS);