Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-767

SessionController does not support custom representations

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.28.0
    • Labels:
      None
    • Complexity:
      Undetermined

      Description

      The SessionController for the REST resource doesn't appear to handle "custom" representations.

      Prior to a recent change, the controller handled converting  to the rep simply by passing the REP into the "convertToRepresentation" method when  converting the User.  In this case, custom rep would be handled, but only if the custom reps were reps for a user. 

      https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/SessionController1_9.java#L66

      This is wrong, but had been in use... in Core Apps, the program, program status and relationships widget used the session and passed in a user-based custom rep: "custom:(privileges)".  (Not custom:(user:(privileges)) which would be the correct rep for a "session")

      Then, recently, we expanded the session to include the session location, and this tries to convert it to the rep as well:

      https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.9/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/SessionController1_9.java#L69

      After this change, the request that the program, program status, and relationship widget now fails if there's a location in the session.

      Ideally, we should change the session controller so that it can properly handle and parse custom reps, but, at a minimum, we should change it so that it returns the default versions of user and session location, or  leave it as-is but document that it doesn't support custom representations. 

       

       

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              mogoodrich Mark Goodrich
              Reporter:
              mogoodrich Mark Goodrich
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: