Skip to content

Commit 77b4616

Browse files
committed
TRUNK-6203: Global properties access should be privileged
1 parent 51130d2 commit 77b4616

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,15 @@ else if (level.getParent() == null){
705705
synchronized public void initializeFullAddressCache() {
706706

707707
// 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")) {
708+
String globalProperty = "";
709+
try {
710+
Context.addProxyPrivilege("GET GLOBAL PROPERTIES");
711+
globalProperty = Context.getAdministrationService().getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP);
712+
} finally {
713+
Context.removeProxyPrivilege("GET GLOBAL PROPERTIES");
714+
}
715+
716+
if (globalProperty.equalsIgnoreCase("true")) {
709717

710718
// only initialize if necessary (and if we have entries)
711719
if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))

0 commit comments

Comments
 (0)