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

(cherry picked from commit f1ebe816b038c58d6f2d02f6ddf12c8b1b7dc211)
This commit is contained in:
Sriharsha Chintalapani 2024-11-06 01:35:32 -08:00 committed by mohitdeuex
parent a68d16c7ca
commit 278d1f638a
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 freemarker.template.TemplateException;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
@ -127,7 +128,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;
@ -482,7 +483,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);
@ -557,6 +558,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);