Security and Permissions
Permissions for resources are stored in Resource.meta.security. A custom code is created for three types of permissions:
- Everyone - Anyone that has a user account in the installation.
- Group - One or more users (Practitioners) that are represented together as a single Group. Use a group to represent a team of users.
- User (Practitioner) - A single person that has access to the installation. ToF requires every user to create a Practitioner that represents their user when the login and open ToF to a specific FHIR server for the first time.
There are two levels of permissions:
- Read - Allows the user to search/view the resource
- Write - Allows the user to update/delete the resource
WIth these concepts combined, the resource may have several security codes. For example:
{
resourceType: "ImplementationGuide",
meta: {
security: [
// Everyone has access to read/wite
{ system: "https://trifolia-fhir.../security", code: "everyone^read" },
{ system: "https://trifolia-fhir.../security", code: "everyone^write" },
// Members of group test-group-id have access to read/write
{ system: "https://trifolia-fhir.../security", code: "group^test-group-id^read" },
{ system: "https://trifolia-fhir.../security", code: "group^test-group-id^write" },
// A specific user (Practitioner) with id test-practitioner-id has access to read/write
{ system: "https://trifolia-fhir.../security", code: "user^test-practitioner-id^read" },
{ system: "https://trifolia-fhir.../security", code: "user^test-practitioner-id^write" }
]
}
}
When a user searches for ImplementationGuide resources, ToF sends a search request to the FHIR server that includes a _security parameter with all possible variations that are applicable to the currently logged-in user. For example:
// un-encoded for readability
https://some-fhir-server.com/fhir/ImplementationGuide?_security=<system>|everyone^read,<system>|group^test-group-id^read,<system>|user^test-practitioner-rid^read
// encoded
https://some-fhir-server.com/fhir/ImplementationGuide?_security=https%3A%2F%2Ftrifolia-fhir...%2Fsecurity%7Ceveryone%5Eread%2Chttps%3A%2F%2Ftrifolia-fhir...%2Fsecurity%7Cgroup%5Etest-group-id%5Eread%2Chttps%3A%2F%2Ftrifolia-fhir...%2Fsecurity%7Cuser%5Etest-practitioner-rid%5Eread
When a user clicks the "Edit" button on a resource, this initiates getting a single/specific resource. The ToF server checks that the persisted resource grants the logged-in user permissions to view the resource before sending the resource back to the user's browser for viewing.
Similarly, when a user clicks "Save" or "Delete", the ToF server first retrieves the instance of the resource that is persisted on the FHIR server, checks whether the user has permissions to modify the resource, and rejects the request with a 401 Unauthorized response if the user does not have permissions. Otherwise, the resource is updated on the FHIR server according to the user's request.
Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator