Access control lists (ACL)
Access control lists with API constructor
In Aidbox you can configure Access control lists using API Constructor.
aidbox.rest.acl
provides a set of operations supporting SQL :filter
s to be added on each request. :filter
s can be used to restrict access to resources
Examples
Code examples on this page are taken from the ACL and the multitenancy example projects
Overview
Available aidbox.rest/op-engine
s
aidbox.rest/op-engine
sExpects the same as regular FHIR API engines and also a :filter
aidbox.rest.acl/search
aidbox.rest.acl/create
aidbox.rest.acl/read
aidbox.rest.acl/update
aidbox.rest.acl/conditional-update
aidbox.rest.acl/delete
aidbox.rest.acl/conditional-delete
aidbox.rest.acl/create-with-filter-table-insert
— create resource and create entry in filter tableaidbox.rest.acl/patient-level-bulk-export
aidbox.rest.acl/group-level-bulk-export
Example
Filter
An ACL operation requires :filter
to be specified. A filter
requires to define :expression
which will be added to a SQL formed by the operation. :expression
is made of templates
joined with :and
or :or
operators. A filter
optionally accepts :filter-table
Example
Filter table insert
aidbox.rest.acl/create-with-filter-table-insert
engine requires :filter-table-insert
property which links operation with the schema tagged with aidbox.rest.acl/filter-table-insert
.
insert-into-filter-table
schema has the following keys:
engine
: currently onlyaidbox.rest.acl/filter-table-insert-row-sql
is supportedfilter-table
: zen symbol defining filter tableparams
: sql parameters. See Parameter section.values
: values to insert in row. This property value is a map in which keys are column names and values are sql substrings for values.
Example
Filter table
Filter table defines SQL table to be joined or searched in with SQL templates.
Example
Template
Defines SQL template string. Accepts params. In the template string you can refer to variables with {{<var>}}
syntax. Available variables:
params
can be referred with{{params.<path>.<to>.<param>}}
syntax.{{filter-table}}
is the:filter-table
added to thefilter
{{target-resource}}
is the jsonb of a resource being checked{{target-id}}
is the id of the resource
Example
Parameter
Defines a path in a request where to get data. The data can be used in a SQL template
Example
Conditional CRUD
By default, aidbox.rest.acl/create
, aidbox.rest.acl/conditional-update
, aidbox.rest.acl/conditional-delete
engines don't make ACL checks on underlying searches. That can lead to "multiple matches" error even when a user doesn't have access to some resources. Such behavior could be overwritten by acl-checks-on-search?
parameter.
Example
Last updated