Openmaize.Authorize.Base

Base module to handle authorization, which is based on user role.

This module provides functions that are called by the various authorization plugs.

You can also define your own plugs, which can call the functions in this module. The Openmaize.Authorize and Openmaize.Authorize.IdCheck modules provide examples of how to write your own plugs.

Summary

Functions

Final step in the authorization process

Function that performs a basic check to see if the path / resource is protected and if the user, based on role, is permitted to access the path

Function that performs the same basic check as full_check, but does not call the authorized? function

Functions

authorized?(arg1, conn, arg3)

Final step in the authorization process.

If the connection is unprotected or if the user is allowed to access the path / resource, the connection, conn, is returned.

If there is an error, then an error is returned with an error message. If the redirects option is set to true, then the user is redirected to a certain page (which is specified in the config).

full_check(conn, opts, data)

Function that performs a basic check to see if the path / resource is protected and if the user, based on role, is permitted to access the path.

part_check(conn, data)

Function that performs the same basic check as full_check, but does not call the authorized? function.

This can be used by plugs that make further checks in addition to the basic authorization. See Openmaize.Authorize.IdCheck for an example of a plug that provides finer-grained authorization.