Wsdataselect.Plug.Authorization (wsdataselect v1.4.2)

Copy Markdown View Source

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

build_authorizations()

@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

call(conn, opts)

Add forbidden_networks in the assigns.

get_authorizations()

@spec get_authorizations() :: list()

A cache management for authorizations

get_forbidden_networks(user)

@spec get_forbidden_networks(String.t()) :: [String.t()]

Get all the defined closed networks where the user is not listed

init(opts)