View Source Bonfire.Boundaries.Queries (bonfire v0.3.5-classic-beta.7)

Helpers for writing common queries. In particular, access control.

Most of this stuff will probably move at some point when we figure out how to better organise it.

Unfortunately, ecto is against the sort of thing we take for granted in the bonfire ecosystem, so some of these patterns are a bit convoluted to make ecto generate acceptable sql. In particular the lateral join and the macro is a bit loltastic when we could just return an arbitrary tuple if ecto would support inferring (or us providing) the return type of a subquery.

Link to this section Summary

Functions

Call the add_perms(bool?, bool?) postgres function for combining permissions.

Call the agg_perms(bool?) postgres aggregate for combining permissions.

A subquery which filters out results the current user is not permitted to perform all of the specified verbs on.

Link to this section Functions

Link to this macro

add_perms(l, r)

View Source (macro)

Call the add_perms(bool?, bool?) postgres function for combining permissions.

Call the agg_perms(bool?) postgres aggregate for combining permissions.

Link to this macro

boundarise(query, field_ref, opts)

View Source (macro)
Link to this function

filter_where_not(user, verbs \\ [:see, :read])

View Source

A subquery which filters out results the current user is not permitted to perform all of the specified verbs on.

Parameters are an expression evaluating to the current user, and a list of verbs.

Link to this function

object_boundarised(q, opts \\ nil)

View Source
Link to this function

skip_boundary_check?(opts, object \\ nil)

View Source
Link to this function

user_and_circle_ids(user)

View Source