Modify check for existing drafts behavior

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Modify check for existing drafts behavior

kiskandar
We're currently passing several query parameters when creating a new form e.g.

http://localhost/orbeon/fr/CPF/test-relevant/new?patientId=IHN:919192§ionId=Outpatients&documentCode=EHF1002

The issue we are facing at the moment is that the search for existing drafts will search for all drafts for the specified app name (CPF) and form name (test-relevant). Is there any way for us pass in the query parameters to the drafts search to further limit the results?

This is what currently see when we search for existing drafts:

2017-08-22 12:58:15,903 8854665 INFO  [http-0.0.0.0-8080-1] persistence.Persistence - POST /cpf/search/CPF/test-relevant Request Content-Type: application/xml
2017-08-22 12:58:15,903 8854665 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - Path Parameters:
2017-08-22 12:58:15,903 8854665 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   appname: [CPF]
2017-08-22 12:58:15,903 8854665 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   formname: [test-relevant]
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - Query Parameters:
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - Request Headers:
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-versioning: true
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-roles: infomedix, system
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-credentials: {"username":"system","groups":["infomedix"],"roles":[{"name":"infomedix"},{"name":"system"}],"organizations":[]}
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   cookie: JSESSIONIDSSO=20B9375F7DDDD618B22E1C44CAEB0C2D
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-username: system
2017-08-22 12:58:15,904 8854666 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-token: d2d6205bb3d6bc2ae52174c4d294679f5ce1d5d9
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   orbeon-group: infomedix
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   transfer-encoding: chunked
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   content-type: application/xml
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   host: localhost:8080
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   connection: Keep-Alive
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence -   accept-encoding: gzip,deflate
2017-08-22 12:58:15,905 8854667 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - Cookies:
2017-08-22 12:58:15,906 8854668 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - JSESSIONIDSSO: path="null" value="20B9375F7DDDD618B22E1C44CAEB0C2D" version=0 domain="null" value=-1 secure=false comment="null"
2017-08-22 12:58:15,909 8854671 DEBUG [http-0.0.0.0-8080-1] persistence.Persistence - Search request body:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<search>
    <drafts for-never-saved-document="true">only</drafts>
    <page-size>10</page-size>
    <page-number>1</page-number>
    <lang>en</lang>
</search>


Kind regards
Kris
Reply | Threaded
Open this post in threaded view
|

Re: Modify check for existing drafts behavior

Alessandro  Vernet
Administrator
Hi Kris,

I am not sure that such a general mechanism to further limit the search exists. However, if permissions are set so users can only access their own data, the search should only return drafts from the current user. And more generally, the search will honor permissions defined in the form in Form Builder. Would this help? Or were you thinking of some other way to limit what drafts are displayed?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Modify check for existing drafts behavior

kiskandar
Hi Alex,

We've set the permissions so that the drafts returned are for the current user only, however our use case is that a single user can have permission to add the same form type to different patients.

At the moment this is what happens:
User goes to patient A and adds form type 1 and saves it as a draft.
User then goes to patient B and adds form type 1 and is prompted that there's a draft for this form type even though it belongs to patient A.

At the moment we're passing in the parameters we need as query parameters which can be accessed by the processes such as save-final and save-draft using xxf:get-request-parameter($name), but we can't find a way to pass these parameters to the search draft request.

One alternative which comes to mind is forwarding these parameters as custom request headers which can then be accessed by our implementation of the persistence API, but we're trying to avoid doing that if at all possible.

Kind regards
Kris
Reply | Threaded
Open this post in threaded view
|

Re: Modify check for existing drafts behavior

Alessandro  Vernet
Administrator
Hi Kris,

I now understand your scenario, and indeed, I can only think of headers as a way to pass such a value to your implementation of the API. I imagine that you could do this in a servlet filter, which takes the value of the patient id request parameter and sets that value in a header. I imagine that you could even do this with UrlRewriteFilter, so you don't have to write any code for this.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet