Skip to content

Commit ca8ffc2

Browse files
committed
ADDR-132: Add 'Get Global Properties' proxy privilege
1 parent 8299adb commit ca8ffc2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

api/src/main/java/org/openmrs/module/addresshierarchy/service/AddressHierarchyServiceImpl.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,21 +703,24 @@ else if (level.getParent() == null){
703703

704704
@Transactional(readOnly = true)
705705
synchronized public void initializeFullAddressCache() {
706-
707706
// generally, this global property should be set to true; it just allows cache load to be disabled to speed startup
708-
if (Context.getAdministrationService().getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP).equalsIgnoreCase("true")) {
709-
707+
708+
Context.addProxyPrivilege("Get Global Properties");
709+
if (Context.getAdministrationService()
710+
.getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP)
711+
.equalsIgnoreCase("true")) {
712+
710713
// only initialize if necessary (and if we have entries)
711714
if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))
712-
&& this.getAddressHierarchyEntryCount() > 0) {
713-
714-
this.fullAddressCache = new HashMap<Locale, Map<String,List<String>> >();
715+
&& this.getAddressHierarchyEntryCount() > 0) {
716+
717+
this.fullAddressCache = new HashMap<Locale, Map<String, List<String>>>();
715718
Locale locale = i18nCache.getLocaleForFullAddressCache();
716719
getAddressesForLocale(locale);
717720
this.fullAddressCacheInitialized = true;
718721
}
719722
}
720-
723+
721724
}
722725

723726
private synchronized Map<String,List<String>> getAddressesForLocale(Locale locale) {

0 commit comments

Comments
 (0)