diff --git a/core/src/main/java/org/fao/geonet/util/XslUtil.java b/core/src/main/java/org/fao/geonet/util/XslUtil.java index 344ce2b2d77..427ce66bb37 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2023 Food and Agriculture Organization of the + * Copyright (C) 2001-2024 Food and Agriculture Organization of the * United Nations (FAO-UN), United Nations World Food Programme (WFP) * and United Nations Environment Programme (UNEP) * @@ -59,6 +59,7 @@ import org.fao.geonet.api.records.attachments.FilesystemStore; import org.fao.geonet.api.records.attachments.FilesystemStoreResourceContainer; import org.fao.geonet.api.records.attachments.Store; +import org.fao.geonet.api.records.attachments.StoreFolderConfig; import org.fao.geonet.constants.Geonet; import org.fao.geonet.domain.*; import org.fao.geonet.index.es.EsRestClient; @@ -102,6 +103,7 @@ import org.owasp.esapi.errors.EncodingException; import org.owasp.esapi.reference.DefaultEncoder; import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; @@ -150,7 +152,7 @@ public static MultiPolygon parseGml(Parser parser, String gml) throws IOExceptio if (value instanceof HashMap) { @SuppressWarnings("rawtypes") HashMap map = (HashMap) value; - List geoms = new ArrayList(); + List geoms = new ArrayList<>(); for (Object entry : map.values()) { addToList(geoms, entry); } @@ -283,7 +285,7 @@ public static MultiPolygon toMultiPolygon(Geometry geometry) { private static final char CS_DEFAULT = ','; private static final char TS_WKT = ','; private static final char CS_WKT = ' '; - private static ThreadLocal allowScripting = new InheritableThreadLocal(); + private static ThreadLocal allowScripting = new InheritableThreadLocal<>(); /** * clean the src of ' and <> @@ -1063,7 +1065,10 @@ public static String reprojectCoords(Object minx, Object miny, Object maxx, Element elemRet = new Element("EX_GeographicBoundingBox", ISO19139Namespaces.GMD); boolean forceXY = Boolean.getBoolean(System.getProperty("org.geotools.referencing.forceXY", "false")); - Element elemminx, elemmaxx, elemminy, elemmaxy; + Element elemminx; + Element elemmaxx; + Element elemminy; + Element elemmaxy; if (forceXY) { elemminx = new Element("westBoundLongitude", ISO19139Namespaces.GMD) .addContent(new Element("Decimal", ISO19139Namespaces.GCO).setText("" + reprojected.getMinX())); @@ -1480,7 +1485,7 @@ public static String getIsoLanguageLabel(String code, String language) { public static List getKeywordHierarchy(String keyword, String thesaurusId, String langCode) { - List res = new ArrayList(); + List res = new ArrayList<>(); if (StringUtils.isEmpty(thesaurusId)) { return res; } @@ -1711,4 +1716,20 @@ private static List buildRecordLink(SearchHits hits, String type) { public static String escapeForJson(String value) { return StringEscapeUtils.escapeJson(value); } + + /** + * get the metadata data directory folder privileges strategy + * + * @return the folder privileges strategy to be used. + */ + public static StoreFolderConfig.FolderPrivilegesStrategy getResourceFolderPrivilegesStrategy() { + try { + StoreFolderConfig storeFolderConfig = BeanFactoryAnnotationUtils.qualifiedBeanOfType(ApplicationContextHolder.get().getBeanFactory(), StoreFolderConfig.class, "storeFolderConfig"); + return storeFolderConfig.getFolderPrivilegesStrategy(); + + } catch (NoSuchBeanDefinitionException ex) { + return StoreFolderConfig.FolderPrivilegesStrategy.DEFAULT; + + } + } } diff --git a/web-ui/src/main/resources/catalog/components/filestore/partials/filestore.html b/web-ui/src/main/resources/catalog/components/filestore/partials/filestore.html index f650c59f205..dcec688aaa1 100644 --- a/web-ui/src/main/resources/catalog/components/filestore/partials/filestore.html +++ b/web-ui/src/main/resources/catalog/components/filestore/partials/filestore.html @@ -70,7 +70,7 @@ - + + + +