Link questionnaire to patient (questionnaire module)

so I'm using the questionnaire module right now, however, with the questionnaire module, all participants can see each published survey. I would like to link them to specific patients, but I can't seem to fix it. Can someone help me?   When I want to assign the questionnaire to the patient, I thought I fixed everything, only the administrator cannot see the list of questionnaires anymore which I created...
2 answers

I do advice to take the Rapid developer learning path first, before directly jumping into a Marketplace module.



Hi Jelle,


if I understand you correctly you’d like that users with the role “Patient” can only view their own questionnaires and users with the “role” admin to view all questionnaires.


There are different options on how to achieve that but assuming you have an association from an “Questionnaire” entity to the “Account” entity you could for example do that by using security → limit access with a Xpath constraint in you access rules.


If your domain model looks e.g. something like this:


You can open the entity properties, go to the “Access rules” tab and create a new access rule. Select the user role for which that rule should be applied (in your case “Patient”) and define the access rights. Once you have done that go to the “XPath constraint” tab and click “Path to user...”


Navigate to the Account entity and click “Select”. You will see that the constraint is automatically written: (these constraint can always be extended to your needs, for example if only questionnaires with a specific status should be visible to that type of user)


Now if you have e.g. a ListView on your homepage with “Questionnaire” from database source a user with the role Patient will only be able to see his own questionnaires.


As mentioned earlier this could also be achieved on different other ways but this one would be also a more secure method. 


Hope that help’s. If you want more specific information on your case you’d have to share more information.