Replace an access policy
- Sandbox: available
- On your own host? Choose https://{host} in the playground.
Replaces an access policy's name and rules, and keeps its other fields. Members who hold the policy gain or lose that access at once. Its copies in child projects follow.
Scope: the caller's project (from the token).
Behaviour
If-Match: W/"<versionId>"is required. A missing header answers428, and one that is not an entity tag answers400.If-Match: *writes over the version Ovok reads just before it. A policy that changed since the version you named answers412: read it again and retry.- Send every rule. A rule you leave out stops applying.
- The rules are checked as on create. Ovok's own policies and copies of a parent project's policies are refused with
POLICY_READ_ONLY.
Example
curl -X PUT 'https://api.sandbox.ovok.com/v1/access-policies/POLICY_ID' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'If-Match: W/"3"' \ -H 'Content-Type: application/json' \ -d '{"name":"Ward nurse","rules":[{"resourceType":"Patient","interaction":["read","search"],"criteria":"Patient?organization=%organization"}]}'Who can call it: a project admin. See roles.
bearerAuthorizationBearer <JWT>id*stringapplication/json- body
name*stringUnique in the project: child copies follow by name.
^[^,\\]+$1 <= length <= 255rules*array<>items <= 300The policy as its members now hold it.
application/json- response
id*stringreference*stringname*stringversionId*stringSend it back as If-Match: W/"<versionId>" to change the policy.
managed*booleanOvok provisions the policy (a Signals role), so it is read-only.
copyOf*stringThe parent project's policy this one copies; read-only here.
rules*array<>Each row with what it grants spelled out in interaction.
curl -X PUT 'https://api.sandbox.ovok.com/v1/access-policies/string' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "rules": [ { "resourceType": "string", "interaction": [ "read" ] } ]}'{ "id": "string", "reference": "string", "name": "string", "versionId": "string", "managed": true, "copyOf": "string", "rules": [ { "resourceType": "string", "interaction": [ "read" ], "criteria": "string", "hiddenFields": [ "string" ], "readonlyFields": [ "string" ] } ]}Delete an access policy DELETE
Deletes an access policy, and its copies in child projects with it. This cannot be undone. **Scope:** the caller's project (from the token). ## Behaviour - A policy that a member holds, or that a project setting such as `DEFAULT_PATIENT_ACCESS_POLICY` names, is refused with `POLICY_IN_USE`. The error says which: `heldByMembers` and `settings`. - Ovok's own policies and copies of a parent project's policies are refused with `POLICY_READ_ONLY`. ## Example ```bash curl -X DELETE 'https://api.sandbox.ovok.com/v1/access-policies/POLICY_ID' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).
Check what a member may do with a resource POST
Shows what a member's own access policy lets them do with one resource of the project. It answers by the rule Medplum would match, and lists what that rule hides. **Scope:** the caller's project (from the token). ## Behaviour - `person` is the member's profile, such as `Practitioner/123`. `resource` is a resource of the project, such as `Patient/456`. `interaction` is `read` by default. - The caller must be able to read `resource` themselves. Otherwise the answer is `404`, so the check reveals nothing the caller's own policy hides. - The policy is the member's own, as Medplum builds it at sign-in: every policy on the membership, with each `access` entry's parameters filled in. - When access is allowed, `rule` is the first rule that matches, as Medplum picks it, and `hiddenFields` are the fields the member does not see. When it is not, `reason` says why: - `no_account`: no active membership in the project. - `no_policy`: the membership has no policy Ovok can apply. Medplum would give it every resource, so Ovok never does. - `no_matching_rule`: no rule grants the interaction on this resource. - For a write, Medplum also applies the rule's `writeConstraint` and `readonlyFields` to the resource being written. This check does not run them: read them in `rule`. - Ovok applies the same decision where it acts for a member, such as who is told of an omni-channel alert. ## Example ```bash curl -X POST 'https://api.sandbox.ovok.com/v1/access-policies/check' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \ -H 'Content-Type: application/json' \ -d '{"person":"Practitioner/PRACTITIONER_ID","resource":"Patient/PATIENT_ID","interaction":"read"}' ``` **Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).