Skip to content

Commit

Permalink
ADDR-132: Add and Remove 'Get Global Properties' proxy privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
Seremba committed Mar 6, 2024
1 parent 67b5e9d commit 02608a4
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -705,19 +705,26 @@ else if (level.getParent() == null){
synchronized public void initializeFullAddressCache() {

// generally, this global property should be set to true; it just allows cache load to be disabled to speed startup
Context.addProxyPrivilege("Get Global Properties");
if (Context.getAdministrationService().getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP).equalsIgnoreCase("true")) {

// only initialize if necessary (and if we have entries)
if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))
&& this.getAddressHierarchyEntryCount() > 0) {

this.fullAddressCache = new HashMap<Locale, Map<String,List<String>> >();
Locale locale = i18nCache.getLocaleForFullAddressCache();
getAddressesForLocale(locale);
this.fullAddressCacheInitialized = true;
try {
Context.addProxyPrivilege("Get Global Properties");
if (Context.getAdministrationService()
.getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP)
.equalsIgnoreCase("true")) {

// only initialize if necessary (and if we have entries)
if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))
&& this.getAddressHierarchyEntryCount() > 0) {

this.fullAddressCache = new HashMap<Locale, Map<String, List<String>>>();
Locale locale = i18nCache.getLocaleForFullAddressCache();
getAddressesForLocale(locale);
this.fullAddressCacheInitialized = true;
}
}
}
finally {
Context.removeProxyPrivilege("Get Global Properties");
}

}

Expand Down

0 comments on commit 02608a4

Please sign in to comment.