Glific v0.3.1 GlificWeb.Tenants View Source
This is the main module of multi-tenancy in Glific. It has been borrowed from Triplex. (https://github.com/ateliware/triplex). However we are going to us postgres row level security instead, and hence copying the code from there. The original copyright and license (MIT) belong to the contributors to Triplex.
The main objetive of it is to make a little bit easier to manage organizations through postgres db schemas or equivalents, executing queries and commands inside and outside the organization without much boilerplate code.
Link to this section Summary
Functions
Given a string from the connection info (subdomain), check and retrieve the organization id.
Returns if the given organization
is reserved or not.
Returns the list of reserved organizations.
Link to this section Functions
Specs
Given a string from the connection info (subdomain), check and retrieve the organization id.
For the short term, we'll default to organization id Glific, if we cannot resolve the sub-domain, we'll remove this in v0.4
Specs
Returns if the given organization
is reserved or not.
The function to_prefix/1
will be applied to the organization.
Specs
reserved_organizations() :: list()
Returns the list of reserved organizations.
By default, there are some limitations for the name of a organization depending on the database, like "public" or anything that start with "pg_".
Notice that you can use regexes, and they will be applied to the organization names.