Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LBAC-10 Added exception for Daemon thread user to access the methods covered with AOP Advices #13

merged 1 commit into from Jul 12, 2018
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+5 −1
Diff settings


Just for now

@@ -20,6 +20,7 @@
import org.openmrs.PersonAttribute;
import org.openmrs.PersonAttributeType;
import org.openmrs.api.context.Context;
import org.openmrs.api.context.Daemon;
import org.springframework.aop.Advisor;
import java.lang.reflect.Method;
@@ -52,9 +53,12 @@ public Advice getAdvice() {

private class PatientSearchAdvise implements MethodInterceptor {
public Object invoke(MethodInvocation invocation) throws Throwable {
Object object = invocation.proceed();
if (Daemon.isDaemonUser(Context.getAuthenticatedUser())) {
return object;
Integer sessionLocationId = Context.getUserContext().getLocationId();
String locationAttributeUuid = Context.getAdministrationService().getGlobalProperty(LocationBasedAccessConstants.LOCATION_ATTRIBUTE_GLOBAL_PROPERTY_NAME);
Object object = invocation.proceed();
if (StringUtils.isNotBlank(locationAttributeUuid)) {
final PersonAttributeType personAttributeType = Context.getPersonService().getPersonAttributeTypeByUuid(locationAttributeUuid);
if (sessionLocationId != null) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.