diff --git a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java index 72b40d62a..7762a01b4 100644 --- a/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java +++ b/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_9/CustomDatatypeResource1_9.java @@ -14,6 +14,7 @@ import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.RefProperty; import io.swagger.models.properties.StringProperty; +import org.openmrs.api.APIAuthenticationException; import org.openmrs.api.context.Context; import org.openmrs.customdatatype.CustomDatatype; import org.openmrs.customdatatype.CustomDatatypeHandler; @@ -129,6 +130,9 @@ protected PageableResult doGetAll(RequestContext context) throws ResponseExcepti } private List getAllCustomDatatypes() { + if(!Context.isAuthenticated()) { + throw new APIAuthenticationException("User must be authenticated!"); + } List datatypeClassnames = CustomDatatypeUtil.getDatatypeClassnames(); List datatypes = new ArrayList();