Update access policy
- Sandbox: available
- Staging: available
- Production: unknown
Replaces an access policy (role) of your project and sets exactly which practitioners hold it.
Auth: Bearer token for a practitioner, project admin or System Owner session. The caller's access policy must grant Practitioner:create, the right to invite users (a project admin who holds no access policy skips this check).
Scope: The policy must belong to the caller's project (from the token). Policies of parent or child projects can be read but not updated here.
Behaviour
policy.idmust equal theidin the path.- The policy body is replaced with
policy. The same interactions as on create are added (Consent;DeviceUseStatementandEpisodeOfCarefor policies that create or updatePatient;ProvenanceandAuditEventforAdminandSystem Ownerpolicies). - You cannot update a policy that ranks above you, nor rename one to a rank above you. Ranks:
System Owner, thenAdmin, then every other policy. - You cannot add or remove a member whose current role ranks above yours. A member ranks as every policy their membership holds now (
accessPolicyand anyaccessentries), each ranked by its name. A project admin (admin: true) ranks as System Owner. membersis the complete list of holders, as references such asPractitioner/<id>:- a listed member's membership in your project now points to this policy, replacing the one it held;
- a current holder not listed loses the policy. Medplum reads a membership with no policy as full access, so if that would leave them with none (no
accessentries, not a project admin), the request answers 409: move them to another role first; - you cannot remove yourself.
- The policy and the membership changes commit together. Past 49 membership changes they are written in two steps.
- The updated policy is then copied by name into each direct child project, also when it was renamed. A failed copy does not fail the request.
- Returns the updated policy with its members.
Example
curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/policy/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{ "policy": { "resourceType": "AccessPolicy", "id": "c3499c27-2973-0a7f-807e-fb8676a92dcb", "name": "Night shift", "resource": [{ "resourceType": "Patient", "interaction": ["read", "search", "update"] }] }, "members": [{ "reference": "Practitioner/c3499c27-2973-0a7f-807e-fb8676a92dcb" }] }'bearerAuthorizationBearer <JWT>id*stringuuidapplication/json- body
Create a policy
policy*members*array<>Access policy updated successfully.
application/json- response
policy*members*array<>curl -X PUT 'https://api.sandbox.ovok.com/v1/slim/policy/497f6eca-6276-4993-bfeb-53cbbbba6f08' \ -H 'Content-Type: application/json' \ -d '{ "policy": { "name": "string", "resourceType": "AccessPolicy", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "resource": [ { "resourceType": "string", "interaction": [ "read" ] } ] }, "members": [ { "reference": "string" } ]}'{ "policy": { "resourceType": "AccessPolicy", "id": "string", "name": "string", "resource": [ { "resourceType": "string", "interaction": [ "string" ], "criteria": "string", "readonly": true } ], "meta": { "project": "string", "author": { "reference": "string" }, "lastUpdated": "string" } }, "members": [ { "reference": "string", "display": "string" } ]}Delete access policy DELETE
Deletes an access policy (role) of your project and detaches it from everyone who holds it. **Auth:** Bearer token for a practitioner, project admin or System Owner session. The caller's access policy must grant `AccessPolicy:delete` and `ProjectMembership:update` (a project admin who holds no access policy skips this check). **Scope:** The policy must belong to the caller's project (from the token). ## Behaviour - A policy is not deleted while a holder would be left with no role (no `access` entry, not a project admin): the request answers 409 until they are moved to another role, because Medplum reads a membership with no policy as full access. Other holders are detached. - You cannot delete a policy you hold yourself. - You cannot delete a policy held by anyone whose role ranks above yours (a project admin ranks as System Owner), since that takes their role away. - Detaching the members and deleting the policy commit together. Past 49 membership changes they are written in two steps. - The policy's copies of the same name in direct child projects are then deleted. A failed copy delete does not fail the request. - Returns an empty body. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/policy/c3499c27-2973-0a7f-807e-fb8676a92dcb' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```
Get practitioner GET
Returns a practitioner profile by id. Use it to show your own profile or, with the extra permission, another practitioner's. **Auth:** Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant `Practitioner:read`. Reading another practitioner's profile also needs `Practitioner:update`. An admin or super admin who holds no access policy skips the access-policy check. **Scope:** Your own profile is always readable. Another practitioner must belong to your project, one of its sub-projects, or its parent project. ## Behaviour - Read-only. - Your own profile is read with your token. Another practitioner's profile is read with Ovok's admin client after the project check above passes. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/slim/practitioner/87ea5dfc-8b8e-384d-8489-79496e706390' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```