diff --git a/amp/WEB-INF/applicationContext.xml b/amp/WEB-INF/applicationContext.xml index 63e0d872753..c10ed74b9a1 100644 --- a/amp/WEB-INF/applicationContext.xml +++ b/amp/WEB-INF/applicationContext.xml @@ -2,17 +2,18 @@ + @@ -21,10 +22,10 @@ - + - - + + @@ -32,43 +33,43 @@ - + - + - + - + - + - + - + - + - + - + @@ -84,13 +85,32 @@ --> - + + + + + + - - - - + + + + + + + + + + + + + + + + + + @@ -99,19 +119,19 @@ - + + request-matcher="regex" security="none" /> + security="none" /> + security="none" /> @@ -119,56 +139,56 @@ - - - - + + + + - - + + - - + + - - - + + + - - - + + + - + - - - + + + - + - - + + - + - + - - + + - - + + @@ -176,8 +196,8 @@ - - + + @@ -186,14 +206,14 @@ - - + + - - - + + + @@ -252,21 +272,21 @@ + class="org.digijava.kernel.security.auth.DigiUserDetailsService"> - + class="org.springframework.security.web.authentication.www.DigestAuthenticationFilter"> + class="org.digijava.kernel.security.auth.AjaxDigestAuthenticationEntryPoint"> @@ -274,4 +294,5 @@ + diff --git a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpLocationFormSectionFeature.java b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpLocationFormSectionFeature.java index 4f380d6caef..58c61980735 100644 --- a/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpLocationFormSectionFeature.java +++ b/amp/WEB-INF/src/org/dgfoundation/amp/onepager/components/features/sections/AmpLocationFormSectionFeature.java @@ -53,7 +53,6 @@ public class AmpLocationFormSectionFeature extends AmpFormSectionFeaturePanel { final AmpCategorySelectFieldPanel implementationLevel; final AmpCategorySelectFieldPanel implementationLocation; - public AmpRegionalFundingFormSectionFeature getRegionalFundingFeature() { return regionalFundingFeature; } diff --git a/amp/WEB-INF/src/org/dgfoundation/amp/visibility/data/FMSettingsMediator.java b/amp/WEB-INF/src/org/dgfoundation/amp/visibility/data/FMSettingsMediator.java index 713b06ad37a..90e4aa38a95 100644 --- a/amp/WEB-INF/src/org/dgfoundation/amp/visibility/data/FMSettingsMediator.java +++ b/amp/WEB-INF/src/org/dgfoundation/amp/visibility/data/FMSettingsMediator.java @@ -1,24 +1,21 @@ /** - * + * */ package org.dgfoundation.amp.visibility.data; import org.apache.log4j.Logger; import org.digijava.module.aim.util.FeaturesUtil; +import org.digijava.module.aim.util.TeamUtil; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Set; +import java.util.*; /** - * Single point of reference for all FM settings groups + * Single point of reference for all FM settings groups * @author Nadejda Mandrescu */ public class FMSettingsMediator { protected static final Logger logger = Logger.getLogger(FMSettingsMediator.class); - + public static final String FMGROUP_COLUMNS = "COLUMNS"; public static final String FMGROUP_MEASURES = "MEASURES"; public static final String FMGROUP_MODULES = "MODULES"; @@ -29,22 +26,22 @@ public class FMSettingsMediator { /** stores all fm groups classes that are manageable via this proxy */ private static Map> registeredFMGroups = initFMGroups(); - + /** stores all instances of fm settings per template */ private static Map> templateToFMGroupMap = Collections.synchronizedMap(new HashMap>()); - + private static Map> initFMGroups() { Map> groups = new HashMap>(); - + groups.put(FMGROUP_COLUMNS, ColumnsVisibility.class); groups.put(FMGROUP_MEASURES, MeasuresVisibility.class); groups.put(FMGROUP_MODULES, ModulesVisibility.class); groups.put(FMGROUP_MENU, MenuVisibility.class); - + return Collections.synchronizedMap(groups); } - + /** * Retrieves a set of enabled settings for the given FM group name * @param fmGroupName @@ -54,21 +51,25 @@ public static Set getEnabledSettings(String fmGroupName, Long templateId if (templateId == null) { templateId = FeaturesUtil.getCurrentTemplateId(); } - + FMSettings fmGroup = getFMSettings(fmGroupName, templateId); - + if (fmGroup != null) { - Set enabledSettings = fmGroup.getEnabledSettings(templateId); + Set enabledSettings = new LinkedHashSet<>(fmGroup.getEnabledSettings(templateId)); if (Objects.equals(fmGroupName, FMGROUP_MENU)) { if (!FeaturesUtil.isVisibleModule(MODULE_GIS)) { enabledSettings.remove(MODULE_MAP); } + boolean loginRequired = FeaturesUtil.getGlobalSettingValueBoolean("Login Required For GIS"); + if (loginRequired && TeamUtil.getCurrentUser()==null) + { + enabledSettings.remove(MODULE_MAP); + } } return enabledSettings; } - return Collections.emptySet(); } @@ -81,12 +82,12 @@ public static Set getSettings(String fmGroupName, Long templateId) { FMSettings fmGroup = getFMSettings(fmGroupName, templateId); return fmGroup.getSettings(); } - + public static boolean supportsFMTree(String fmGroupName, Long templateId) { FMSettings fmGroup = getFMSettings(fmGroupName, templateId); return fmGroup == null ? false : fmGroup.supportsFMTree(); } - + public static FMTree getEnabledSettingsAsTree(String fmGroupName, Long templateId) { FMSettings fmGroup = getFMSettings(fmGroupName, templateId); if (fmGroup != null) { @@ -94,7 +95,7 @@ public static FMTree getEnabledSettingsAsTree(String fmGroupName, Long templateI } return new FMTree(null, false); } - + /** * Identify the template group & create it if doesn't exist yet * @param id @@ -109,7 +110,7 @@ private static Map getTemplate(Long id) { } return templateGroup; } - + /** * Identifies fmGroup settings object for the given group name within a specific template group * @param templateGroup @@ -130,7 +131,7 @@ private static synchronized FMSettings getFMSettings(String fmGroupName, Long te } } else { // fallback to the generic settings - ModulesVisibility modulesSettings = (ModulesVisibility) + ModulesVisibility modulesSettings = (ModulesVisibility) getFMSettings(FMSettingsMediator.FMGROUP_MODULES, templateId); String fmModule = modulesSettings.getOrigName(fmGroupName); fmGroup = new GenericVisibility(fmModule, templateId); diff --git a/amp/WEB-INF/src/org/digijava/kernel/util/GisSecurityUtilService.java b/amp/WEB-INF/src/org/digijava/kernel/util/GisSecurityUtilService.java new file mode 100644 index 00000000000..d775bee59eb --- /dev/null +++ b/amp/WEB-INF/src/org/digijava/kernel/util/GisSecurityUtilService.java @@ -0,0 +1,21 @@ +package org.digijava.kernel.util; + +import org.digijava.module.aim.util.FeaturesUtil; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; + +@Component +public class GisSecurityUtilService { + public boolean isUserAllowedAccess(HttpServletRequest request, Authentication authentication) { + boolean loginRequired = FeaturesUtil.getGlobalSettingValueBoolean("Login Required For GIS"); + if (loginRequired) + { + return !(authentication instanceof AnonymousAuthenticationToken) && authentication.isAuthenticated(); + + } + return true; + } +} diff --git a/amp/deployConfigs/selected.properties b/amp/deployConfigs/selected.properties index dfac287b7fb..6524154a9b7 100644 --- a/amp/deployConfigs/selected.properties +++ b/amp/deployConfigs/selected.properties @@ -1,4 +1,3 @@ #Description of the selected config -#Wed, 03 Apr 2024 18:04:31 -0300 serverName=generic diff --git a/amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml b/amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml new file mode 100644 index 00000000000..0ccc576f1ae --- /dev/null +++ b/amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml @@ -0,0 +1,16 @@ + + + GGW-207 + bmokandu + Login Required for GIS. + + + +