Play through the internal authorization system. This Plug needs to strt AFTER authenication and uses the user assign in the plug.
The plug creates a new assign "forbidden_networks" containing a list of networks that need to be filtered out.
Summary
Functions
Get all the closed networks from database, extended form. Make a map of those, with empty authorized users list. Merge with the authorized users NOTE: This function will evolve as soon as Sigma provides an endpoint with authorisations
Add forbidden_networks in the assigns.
A cache management for authorizations
Get all the defined closed networks where the user is not listed
Functions
@spec build_authorizations() :: map()
Get all the closed networks from database, extended form. Make a map of those, with empty authorized users list. Merge with the authorized users NOTE: This function will evolve as soon as Sigma provides an endpoint with authorisations
Add forbidden_networks in the assigns.
@spec get_authorizations() :: list()
A cache management for authorizations
Get all the defined closed networks where the user is not listed