Skip to content

Commit c5a42d2

Browse files
committed
TRUNK-6203: Global properties access should be privileged
1 parent a6dda61 commit c5a42d2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

omod/src/main/java/org/openmrs/module/referenceapplication/page/controller/LoginPageController.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.openmrs.ui.framework.annotation.SpringBean;
3434
import org.openmrs.ui.framework.page.PageModel;
3535
import org.openmrs.ui.framework.page.PageRequest;
36+
import org.openmrs.util.PrivilegeConstants;
3637
import org.openmrs.web.user.CurrentUsers;
3738
import org.springframework.stereotype.Controller;
3839
import org.springframework.web.bind.annotation.CookieValue;
@@ -150,9 +151,14 @@ public String get(PageModel model, UiUtils ui, PageRequest pageRequest,
150151
}
151152

152153
private boolean isLocationUserPropertyAvailable(AdministrationService administrationService) {
153-
String locationUserPropertyName = administrationService
154-
.getGlobalProperty(ReferenceApplicationConstants.LOCATION_USER_PROPERTY_NAME);
155-
154+
String locationUserPropertyName;
155+
try {
156+
Context.addProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
157+
locationUserPropertyName = administrationService
158+
.getGlobalProperty(ReferenceApplicationConstants.LOCATION_USER_PROPERTY_NAME);
159+
} finally {
160+
Context.removeProxyPrivilege(PrivilegeConstants.GET_GLOBAL_PROPERTIES);
161+
}
156162
return StringUtils.isNotBlank(locationUserPropertyName);
157163
}
158164

0 commit comments

Comments
 (0)