From de12c70c3de6881d7e142081a34d087067cb20be Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 18 Jan 2024 18:42:53 +0300 Subject: [PATCH 1/7] GGW-207- Require Login for GIs --- .../amp/visibility/data/FMSettingsMediator.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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..61ed439f813 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 @@ -5,12 +5,9 @@ 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 @@ -58,11 +55,16 @@ public static Set getEnabledSettings(String fmGroupName, Long templateId 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; From 7e3bf8f52e9fb313381cc19864dd3cb33b783a37 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 18 Jan 2024 18:44:07 +0300 Subject: [PATCH 2/7] GGW-207- Require Login for GIs --- amp/WEB-INF/applicationContext.xml | 157 ++++++++++++++++------------- 1 file changed, 89 insertions(+), 68 deletions(-) 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 @@ + From 69ba64fd1756fac1d6ff5c41d0399a4636ff189b Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 18 Jan 2024 18:45:28 +0300 Subject: [PATCH 3/7] GGW-207- Require Login for GIs --- .../kernel/util/GisSecurityUtilService.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 amp/WEB-INF/src/org/digijava/kernel/util/GisSecurityUtilService.java 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; + } +} From de89026a8b6c632b49acfbcb1adb5e46bdabf518 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 18 Jan 2024 18:50:36 +0300 Subject: [PATCH 4/7] GGW-207- Require Login for GIs --- amp/deployConfigs/selected.properties | 2 +- .../4.0/GGW-207-Require-Login-For-GIS.xml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml diff --git a/amp/deployConfigs/selected.properties b/amp/deployConfigs/selected.properties index 093ff8c2aaf..5db1566e553 100644 --- a/amp/deployConfigs/selected.properties +++ b/amp/deployConfigs/selected.properties @@ -1,4 +1,4 @@ #Description of the selected config -#Sun, 07 Jan 2024 10:06:08 +0300 +#Thu, 18 Jan 2024 18:47:43 +0300 serverName=local 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..c7bf3a8541b --- /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. + + + + From 0099e17ef511de9e510b13ba63534274a0085a8a Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 26 Mar 2024 22:27:07 +0300 Subject: [PATCH 5/7] AMP-30853- Configure multicountry for Ecowas --- amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index c7bf3a8541b..0ccc576f1ae 100644 --- a/amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml +++ b/amp/xmlpatches/4.0/GGW-207-Require-Login-For-GIS.xml @@ -9,7 +9,7 @@ From 0b8d0b397baaabbc469e348f0168114342b790f0 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 6 May 2024 21:19:29 +0300 Subject: [PATCH 6/7] GGW-207-Require Login for GIS --- .../features/sections/AmpLocationFormSectionFeature.java | 1 - 1 file changed, 1 deletion(-) 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; } From 504966d4ac59ef4b5ea80051c88936c4950fd245 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 6 May 2024 21:27:03 +0300 Subject: [PATCH 7/7] GGW-207-Add-setting-for-Login --- .../ampTemplate/node_modules/amp-boilerplate | 2 +- .../ampTemplate/node_modules/amp-filter | 2 +- .../visibility/data/FMSettingsMediator.java | 31 +++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate b/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate index 9f5127d3f53..bd01bc6e1c3 160000 --- a/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate +++ b/amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate @@ -1 +1 @@ -Subproject commit 9f5127d3f53a16deb8f4f683a96ad45119646684 +Subproject commit bd01bc6e1c3d63a24af5641bec551e351395d9fb diff --git a/amp/TEMPLATE/ampTemplate/node_modules/amp-filter b/amp/TEMPLATE/ampTemplate/node_modules/amp-filter index 110570ef0e3..cff3d8f8bf5 160000 --- a/amp/TEMPLATE/ampTemplate/node_modules/amp-filter +++ b/amp/TEMPLATE/ampTemplate/node_modules/amp-filter @@ -1 +1 @@ -Subproject commit 110570ef0e377d5f34b59fe83a99c0d6e027cac3 +Subproject commit cff3d8f8bf56e50dc383f50628efadb4e654e811 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 61ed439f813..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,5 +1,5 @@ /** - * + * */ package org.dgfoundation.amp.visibility.data; @@ -10,12 +10,12 @@ 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"; @@ -26,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 @@ -51,9 +51,9 @@ public static Set getEnabledSettings(String fmGroupName, Long templateId if (templateId == null) { templateId = FeaturesUtil.getCurrentTemplateId(); } - + FMSettings fmGroup = getFMSettings(fmGroupName, templateId); - + if (fmGroup != null) { Set enabledSettings = new LinkedHashSet<>(fmGroup.getEnabledSettings(templateId)); if (Objects.equals(fmGroupName, FMGROUP_MENU)) { @@ -70,7 +70,6 @@ public static Set getEnabledSettings(String fmGroupName, Long templateId return enabledSettings; } - return Collections.emptySet(); } @@ -83,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) { @@ -96,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 @@ -111,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 @@ -132,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);