There are a number of use cases when user should be granted with access to some resources (episode, encounter, etc.) based on different business rules.
JUST examples:
- User can read the complete patient medical data in case if it's employee has active declaration with the patient
- User can read some part of medical data in case if it's legal entity has declaration with the patient
- User can read episode details, in case if referral linked with the episode has been assigned to user,
- etc.
That's why ABAC (Attribute-based access control) paradigm should be used to control access to the medical data resources on the top of the scope model.
Medical events Access policy can be found here
General Concept design
- ABAC is an independent microservice
- It is responsible for granting access to resources based on attributes of any business entity that are requesting access for.
- Service will not support UI editing of rules
- Service should provide RPC (or similar as service must not spend additional computation time on decoding/encoding and networking)
- Service must store audit log in files with two main events: "Successful access grants", "Access rejects".
- Service must cache data for resources, with cache lifetime on per resource sets
- ABAC is additional level of authorization on the top of the regular scope-based access model.
Usage
- ABAC might (NOT MUST) be used as a plug for any ME endpoint or even ehealth endpoint. Otherwise there might be performance issues.
- It should be checked on the gateway level.
- We do limit access by default. It means that all the rules describe conditions when access is allowed. If there is no rule matched - access is forbidden.
- If ABAC failed to answer - access is forbidden.
- ABAC - mission critical service
- interface: external: http, data providers: RPC
- Input:
- WHO
- user_id
- client_id + client_type
- action: CREATE, READ, UPDATE, DELETE
- WHAT
-
object_type + object_id
- list of contexts (patient, episode):
object_type + object_id
-
- WHO
- Output:
- decision: true/false
- To be considered in future!! Conditions - optional. Is relevant for lists. Defines additional instructions for the requested application.
- For example: client_id context should be applied
- For example: speciality context should be applied
- Technically ABAC can take decision based on attributes of any entity. But to minimize load on the service it has been decided that we do restrict access not lower that on EPISODE level.
- examples:
- access to endpoint like `/api/patients/{patient_id}/conditions/{condition_id}` will be granted based on patient level rule
- access to endpoint like `/api/patients/{patient_id}/conditions/` will be granted based on patient level rule
- access to endpoint like `/api/patients/{patient_id}/episodes/{episode_id}/encounters/` can be granted based on patient or episode level rule
- If there is a rule that allows user to get access to the patient level, but no rule that allows on the episode level, access should be allowed
- examples:
Limitations
- ABAC doesn't provide possibility to manage access to lists of resources - May be implemented in future
- It means that if there is a business rule that '/api/patients/{patient_id}/conditions/' should return only conditions that are referenced to episodes of the legal_entity. This rule will not be implemented on ABAC.
Architecture
Data model - TBD
https://docs.google.com/spreadsheets/d/1A59VIXzxJGLxdd6XH2siPQqOcgVfkGy-1mpR7_4vK4Y/edit#gid=0