Skip to content

Commit

Permalink
RESTWS-952 Require authentication for fetching CustomDatatypes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkorytkowski committed Aug 1, 2024
1 parent 2fb8658 commit ed17026
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -129,6 +130,9 @@ protected PageableResult doGetAll(RequestContext context) throws ResponseExcepti
}

private List<CustomDatatypeRepresentation> getAllCustomDatatypes() {
if(!Context.isAuthenticated()) {
throw new APIAuthenticationException("User must be authenticated!");
}
List<String> datatypeClassnames = CustomDatatypeUtil.getDatatypeClassnames();

List<CustomDatatypeRepresentation> datatypes = new ArrayList<CustomDatatypeRepresentation>();
Expand Down

0 comments on commit ed17026

Please sign in to comment.