View Source Backstage.Interface.Authorization protocol (backstage v0.0.2)

A mechanism for controlling access to some or all commands in an application.

Order of Operations

Authorization checks should be performed before dispatching commands.

  1. An actor submits a form or presses a button via a Web or API interface.
  2. The application confirms the user is allowed to trigger the command.
  3. If allowed, the command is dispatched upon successful validation.

Authorization Types

This protocol supports a wide variety of access controls. An application may perform checks based on the actor's role, a relation to another entity affected by the command, permissions assigned to the actor, and any logic that can be written into a function.

Authorization TypeSupported?
Global Role-Based Access ControlYes
Organization-Level Role-Based Access ControlYes
Relationship-Based Access ControlYes
Attribute-Based Access ControlYes

Summary

Types

t()

All the types that implement this protocol.

Functions

For a given command, perform any necessary checks to provide a response.

Types

@type response() :: :yes | {:no, term()}
@type t() :: term()

All the types that implement this protocol.

Functions

Link to this function

allow?(command, actor, opts)

View Source
@spec allow?(command :: Backstage.Command.t(), actor :: struct(), opts :: Keyword.t()) ::
  response()

For a given command, perform any necessary checks to provide a response.